- HW№13(due date is Friday, December 14th): - Last Homework
Write a program that will read-in five words (from the keyboard, one by one), then it should:
1. output the length of each word.
2. concatenate these words, putting two *'s between them.
3. compares consecutive pairs of words to check if they are equal. - HW№12(due date is Monday, November 29th):
1. Write a program that will copy all the information from one file to the file copy-of-input.dat. User should be asked for the input file name (it should be an existing file and it should contain something). Your program should copy everything (symbol by symbol) from this file to the file copy-of-input.dat
2. Write a program that will do a search for a value in an array of 12 elements.
Comments:
1. The array consists of 12 elements
2. User inputs the values of elements
3. User inputs the value to be searched for in the array
4. Program searches the array and outputs the index of an element which is the one we are looking for. If array doesn't have such number, the program should output: "No such number in the array".
3. Modify the program 2 so that the size of the array is not known in advance (the user will enter the size of the array)
- HW№11(due date is Monday, November 19th):
Write a program that will do the following:
- asks a file name (for the input stream)
(don't forget to check for existance of the file)
- reads all the numbers from that file and adds them up
(it should do it till it reaches the end of the file – see member function eof)
- appends the result to the output file output.dat
User should be able to run the program as many times as user wants (user should also be asked an input file name for each run/iteration)
- HW№10(due date is Wednesday, November 14th):
write a program that will read in 5 numbers from a file (you can choose any file name, e.g. ''infile.dat'' or ''in.dat''), print them out to screen, then take their product and output into an output file with any name, e.g. ''output.dat'')
- HW№9(due date is Monday, November 12):
program #0(not from the book): Write a program that declares two variables (of type char) in the main function and initializes them with the symbols/characters inputed by the user and, then calls a function that swaps them. And then, the values of these two variables are printed on the screen from the main function,
page 293/1
Please, note that you have two programs to do.
- HW№8(due date is Wednesday, November 7):
Write functions that find the average of three numbers or of four numbers, and the largest of three or of four numbers. Then write a program that should do the following:
- The program should ask the user to enter the average of how many numbers she/he would like to find (so the user enters either 3 or 4).
- Then the program should ask to enter those numbers.
- And after it the program should find the average of those numbers and the largest of those numbers.
Note: it is a good idea to write a function that finds the largest of two numbers too – because you can use it in the function that finds the largest of three numbers (see example in the lecture slides)
- HW№7(due date is Monday, November 5):
page 244/9 (modification: number 2.9 from the Hat size formula should be declared as a global constant)
- HW№6(due date is Wednesday, October 17):
page 174/8,
Read section 3.4 Designing loops.
- HW№5(due date is Wednesday, October 10):
Do the programming project 1 from HW№4 using for-loop.
- HW№4(due date is Monday, October 1):
page 104/1
programming project 1: write a program that will ask the user to input a decimal number (say n) then will ask to imput another decimal number (say m). m should be less than n. And then using while loop-mechanism will find how many m's fit in n.
- HW№3(due date is Monday, September 24):
page 105/6 (don't do a harder version)
- HW№2 (due date is Monday, September 17):
p. 37 / 6,7,8
- HW№1 (due date is Monday, September 10):
Write a program that computes the volule of a box.
The formula for computing the volume of a box is
Volume = length * width * height.
The program should get the values for length, width, and height from the user at the console and output the volume to the screen.