Lab exercises
1) Using if statements in the program, ask someone for his or her first and last name. If the total number of letters in both names is more than 20, tell them that their name is too long and that they must shorten it.
Google "C++ string length"
2) Look up the ?: operator, and modify one of Dr. Ryba's if programs to use this operator instead.
3) Using ifs, take in a number and find out if it is a leap year. The rules for
leap year are as follows:
every 4th year is a leap year
unless it is a century
unless it is a 4th century, in which case it is a leap year
Monday, February 22, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment