- Write a program to test each of the following,
such that it reads in the data from the keyboard
and stores the values in to variables a, b, c and d
- What does your scanf need to look like if the
user will input the following (a, b, c are integers,
d is a char):
213 145 14Z
- What does your scanf need to look like if the
user will input the following (a, b, c are integers,
d is a char):
213 145 14 Z
- What does your scanf need to look like if the
user will input the following (a is an integer,
b is a float, d is a char):
213 1.45 Z
- What's the difference between the following:
scanf( "%d%d%c", &a, &b, &c );
and
scanf( "%d %d %c", &a, &b, &c );
- How would you get the user to enter a date with slashes, e.g. 11/25/2006 and store the month in a, day in b and year in c?
- What happens if you have
scanf( "%d %d %c", &a, &b, &c );
BUT you only enter 2 values then press enter when the program runs?
- What happens if you have
scanf( "%d %d %c", &a, &b, &c );
BUT you enter 4 values then press enter when the program runs?
- What happens if you have
scanf( "%d %d", &a, &b, &c );
- Write a program that prompts the user to enter a quantity and a cost.
The values are to be read in to an integer named qty and a float
named unitPrice. Use only one statement to read in the values.
Then skip a line and print each value with an appropriate description.
- Write a program that reads in two values and prints the average.
-