Suggested Projects

 < Day Day Up > 



  1. Calculate Averages: Write a program that calculates the average age of the members of your family. If you have a large family limit the number of ages you use to ten. Use the cout object to prompt for the entry of each age. Use the cin object to read the input from the keyboard and store it in a variable. Use the technique shown in the chapter to trap bad input.

  2. Calculate Area: Write a program that calculates the area of a square given the length of one side. Use the cout object to prompt for input and the cin object to read the input from the keyboard and assign it to a variable for computation.

  3. Calculate Area: Write a program that calculates the area of a rectangle given its length and width.Use the cout object to prompt for input and the cin object to read the input from the keyboard. Use two variables of the appropriate type to store the store the values of length and width. Print the values of the rectangle’s length and width, and its area, using cout.

  4. Experiment: Write a program that prints out all the escape sequences listed in table 5-2. You may want to add characters to the output string when printing the horizontal tab and vertical tab so you can gage the effect.

  5. Bitwise AND: Write a program that takes two hexadecimal numbers as input, performs a bitwise AND on them, and displays the result.

  6. Bitwise Exclusive OR: Write a program that takes two hexadecimal numbers as input, performs a bitwise exclusive OR on them, and displays the result.

  7. Bitwise Inclusive OR: Write a program that takes two hexadecimal numbers as input, performs a bitwise inclusive OR on them, and displays the result.

  8. Comparison Operators: Write a program that takes two decimal integers as input, compares their values with the <, >, <=, and >= operators, and displays the results.

  9. Calculate Formula: Write a program that performs the following computation:

Enter the values for a, b, and c from the keyboard. Display the value of x using cout.

  1. Left Shift, Right Shift: Write a program that reads a decimal value from the keyboard, stores it in a variable, left shifts it 4 bits, prints the value, then right shifts it 8 bits and prints the value.



 < Day Day Up > 



C++ for Artists. The Art, Philosophy, and Science of Object-Oriented Programming
C++ For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504028
EAN: 2147483647
Year: 2003
Pages: 340
Authors: Rick Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net