Thursday, September 24, 2009

Lab 7

1) take in a number, and count how many times the number 3 occurs as a digit.

2) take in a number and reverse it, except where the digit is 3, replace it instead with the digit 5.

3) take in a number and print out all the factors of that number.

4) read in two numbers, x and y. If both x and y are odd, print "both odd." if they are both even, print "both even". if one is even and one is odd, print that.

5) read in a number and tell me whether it is in the range of 5 to 10.

Tuesday, September 22, 2009

Lab 6

1) Write a program that prompts
for firstname and lastname. The
combined name should not be longer
than 20 characters long. If it
is longer, give them a second chance.

2) Modify the above to give, instead, as many times as necessary
to fix the input. This should be a
separate program.

3) Modify the above to give three
attempts.

4) Print the first 10 numbers, together with their squares (rather than square roots).

5) Print the first 10 numbers, together with their cubes (rather than square roots).

Thursday, September 17, 2009

Quiz 1

Lab 5

If statements

1) calculate a grade. usually is average of midterm and final, but if the bribe is greater than $50, then the student gets 100.

2) make a program which asks for a password, and if the password (which is "swordfish") is correct, tell them the secret. otherwise, insult them and exit the program.

3) modify your temperature conversion program from last lab. This time, at the start, after taking in the degrees in Kelvin, ask them in what temperature they would like the result. Then, tell them what the result is in that temp scale.

4) Read through the web page here on modulo arithmetic. Write a program which will solve all the problems on that page.

Tuesday, September 15, 2009

Lab 4

1) Take in a number such as 3.14, and print out only the portion after the decimal point, e.g. 0.14.

2) Here from Wikipedia, are conversions from to various temperature scales from Kelvin. Write a program which takes in a temperature in Kelvin and converts it into each of these other temperature scales.


from Kelvin
Celsius [°C] = [K] − 273.15
Fahrenheit [°F] = [K] × 95 − 459.67
Rankine [R] = [K] × 95
Delisle [°De] = (373.15 − [K]) × 32
Newton [°N] = ([K] − 273.15) × 33100
Réaumur [°Ré] = ([K] − 273.15) × 45
Rømer [°Rø] = ([K] − 273.15) × 2140 + 7.5

Then, submit the resulting program on the form below.

Thursday, September 10, 2009

Lab 3

Three things to work on:

1) A program which gets in the speed (in mph) and time elapsed (in hours), and calculates and prints out the distance traveled.

2) A program which gets in the cost of an item as well as the percentage sales tax, and calculates and prints out the total cost of the item.

3) A program which will take in an initial deposit to a bank plus the annual effective interest rate per year, compounds that four three years, and calculates and prints out the future value of that deposit.


Tuesday, September 1, 2009

hw 1

download c++ express edition at home

take team photo, make team name
send an email with subject including
CS111 hw1
includes picture
a program which will print out Hi Josh from Team [TeamName]