Please send questions to
st10@humboldt.edu .
/*-----
Signature: main: void -> int
Purpose: to just play with using cin with
different types of variables
Examples: if, when this program is run, the
user types the following when
prompted:
3
1.4
a
dachshund
true
...then the following should be printed
to the screen:
the int read in was: 3
the double read in was: 1.4
the char read in was: a
the string read in was: dachshund
the bool read in was: true
by: Sharon Tuttle
last modified: 11-18-2010
-----*/
#include <iostream>
#include <string>
using namespace std;
int main()
{
int an_int;
double a_double;
char a_char;
string a_string;
bool a_bool;
cout << "Enter an integer, a double, " << endl
<< " a char, a string, and a bool"
<< endl;
cout << " following each by a return: "
<< endl;
cin >> boolalpha >> an_int >> a_double
>> a_char >> a_string >> a_bool;
cout << boolalpha
<< "the int read in was: " << an_int << endl
<< "the double read in was: " << a_double
<< endl
<< "the char read in was: " << a_char
<< endl
<< "the string read in was: " << a_string
<< endl
<< "the bool read in was: " << a_bool
<< endl;
return EXIT_SUCCESS;
}