|
1. |
Complete the tasks from
last
week. |
|
2. |
Download the
code for
this week's notes. Go through all the code, compiling and running each
program separately. If you have any problems, ask the lab supervisor
for help, or take a note of the problem and we can discuss it in next
week's class. The code is bundled into a ZIP
file. This is a compressed file which contains all the separate source
code files. To open this file and extract the contents, you can use
the WinZip tool which is available in the lab, and is available for
free download here.
Make sure to put all your code into a folder named
week_4 in your programming folder on your u: drive.
|
|
3. |
Write a program to read in 15 numbers and display them
on the same line separated by semi-colons. Use loops and arrays.
Name the program paa_ex_04_01.c.
See sample solution here.
|
|
4. |
Rewrite the program so that the numbers are displayed
in reverse order. Name the program
paa_ex_04_02.c.
See sample solution here.
|
|
5. |
Write a program which will display a suduko square (9 *
9 ints), with a 0 in each square. You should then prompt the user to
enter a number into a square identified by its row and column. Users
should be continuously prompted until the square is full. Each time a
new number is added, the square should be redrawn.
Name the program paa_ex_04_03.c.
See sample solution here.
|
|
6. |
Write a program which asks the user to enter their full
name and then prints out their first name and surname separately.
(Hint: use the fact that the string is an array of
characters, and the names are separated by a space character.)
Name the program paa_ex_04_04.c.
See sample solution here.
|
|
7. |
Write a program to allow the user enter 5 countries and their capital
cities. When everything has been entered, the user is prompted for a
country. The capital city of that country is then printed out. Name
the program paa_ex_04_05.c.
See sample solution here.
|