CS 16 HW02 Vicki Chen ID 8757122 1 int feet 0 inches 0 int feet 0 inches 0 2 double n 5 int n 5 3 Auto speed hourly pay highest score 4 int the number cout Please enter a number endl cin the number 5 cout Please enter a number endl 6 cout endl 7 cout precision 4 8 if score 100 cout High else cout Low 9 if temperature 100 pressure 200 cout warning endl else cout Ok endl 10 10 7 4 1 11 No output because x is not less than zero therefore the loop body is not executed 12 const double PI 3 14 13 When you initialize a variable inside a declaration you can mark the variable so that the program is not allowed to change its value 14 include iostream include cstdio using namespace std int main CS 16 HW02 int a b c cout Enter your first number endl cin a cout Enter your second number endl cin b cout Enter your third number endl cin c if a b and a c if b c cout True endl else cout False endl 15 a True b True c False 16 1 1 2 1 17 2 4 6 8 18 a for loop b for loop c while loop 19 2015 00000111 11011111 2015 11111000 00100001 6666 00011010 00001010 12345 00110000 00111001 20 1 25 00111111 10100000 00000000 00000000 0 09375 10111101 11000000 00000000 00000000 Vicki Chen ID 8757122 CS 16 HW02 1234 5 01000100 10011010 01010000 00000000 256 625 11000011 10000000 01010000 00000000 Vicki Chen ID 8757122
View Full Document
Unlocking...