1: //test_readfuns.cpp
2: //A test driver for the following functions:
3: //- Scobey::ReadChar()
4: //- Scobey::ReadDouble()
5: //- Scobey::ReadInt()
6: //- Scobey::ReadNextLine()
7: //- Scobey::ReadThisLine()
8: //- Scobey::ReadString()
10: #include <iostream>
11: #include <string>
12: using namespace std;
14: #include "utilities.h"
15: using Scobey::ReadChar;
16: using Scobey::ReadDouble;
17: using Scobey::ReadInt;
18: using Scobey::ReadNextLine;
19: using Scobey::ReadThisLine;
20: using Scobey::ReadString;
21: using Scobey::Pause;
23: int main()
24: {
25: Pause(0, "\nTesting the following free functions:"
26: "\n- Scobey::ReadChar()"
27: "\n- Scobey::ReadDouble()"
28: "\n- Scobey::ReadInt()"
29: "\n- Scobey::ReadNextLine()"
30: "\n- Scobey::ReadThisLine()"
31: "\n- Scobey::ReadString()");
33: char c;
34: ReadChar("Enter a single character: ", c);
36: double d;
37: ReadDouble("\nEnter a real number value: ", d);
39: int i;
40: ReadInt("\nEnter an integer value: ", i);
42: string s;
43: ReadString("\nEnter a string: ", s);
45: string nextLine, thisLine;
46: ReadNextLine("\nEnter some text on the line below: ", nextLine);
47: ReadThisLine("\nEnter some text on this same line: ", thisLine);
49: cout << "\n============================"
50: "\nHere are the values read in:\n";
51: cout << "\nThe character..... " << c
52: << "\nThe real number... " << d
53: << "\nThe integer....... " << i
54: << "\nThe string........ " << s
55: << "\n\nThe text on the line following the prompt:\n"
56: << nextLine
57: << "\n\nThe text on the same line as the prompt:\n"
58: << thisLine << endl;
59: Pause();
61: Pause(0, "No more tests to perform."
62: "\nProgram will now terminate.");
63: }