getchar()
to get two letters from the user.
getchar()
, which reads one character at a time from the input stream.
In other words, you need to use getchar()
twice to input one character.
The first getchar()
removes the character from the input stream and stores the character.
The second getchar()
removes the newline character from the input stream.
getdouble()
to get two numbers from the user.
getdouble()
requires the use of files
getdouble.c and
getdouble.h and
alterations to the makefile
makefile-double.
#include "getdouble.h"
Here are three example inputs and outputs by running the program three times.
Please enter a letter: w The 1st letter is: 'w' Please enter another letter: a The 2nd letter is: 'a' Please enter a number: 12345.6789 The 1st number is: 12345.678900 Please enter another number: 0.123456789 The 2nd number is: 0.123457 Please enter a letter: e The 1st letter is: 'e' Please enter another letter: H The 2nd letter is: 'H' Enter a number: 88 The 1st number is: 88.000000 Enter a another number: 88.888 The 2nd number is: 88.888000 Please enter a letter: Y The 1st letter is: 'Y' Please enter another letter: q The 2nd letter is: 'q' Enter a number: 5.55 The 1st number is: 5.550000 Enter a another number: 333.333333 The 2nd number is: 333.333333