Source of TestStuff20140915.cpp


  1: //TestStuff20140915.cpp

  2: //Monday, September 15, 2014

  3: 
  4: #include <iostream> //this is where cout, endl and cin.ignore() live

  5: #include <fstream> //this is where ifstream and ofstream live

  6: #include <string> //this is where getline() and to_string() live

  7: #include <cstdlib> //this is where atoi() lives

  8: using namespace std; //<- This is a "using directive"

  9: 
 10: #include "utilities.h"

 11: //Each of the following is a "using declaration"

 12: using Scobey::DisplayOpeningScreen;
 13: using Scobey::Pause;
 14: using Scobey::TextItems;
 15: 
 16: void GetTwoValuesFromUser
 17: (
 18: int& i, //out

 19: int& j  //out

 20: )
 21: {
 22:     cout << "\nEnter two integer values: ";
 23:     cin >> i >> j;
 24: }
 25: 
 26: void DisplayValues
 27: (
 28: int i, //in

 29: int j  //in

 30: )
 31: {
 32:     cout << "The first value entered was " << i << ".\n";
 33:     cout << "The second value entered was " << j << ".\n";
 34: }
 35: 
 36: int main(int argc, char* argv[])
 37: {
 38:     //int i;

 39:     //double d;

 40:     //cin >> i;

 41:     //cin >> d;

 42:     ////cin >> i >> d; //Equivailent to the above two lines

 43:     //cout << i << endl;

 44:     //cout << d << endl;

 45: 
 46:     //string line;

 47:     //getline(cin, line); //Reads an entire line, discards the newline

 48:     //cout << line << endl;

 49: 
 50:     //cin >> line; //Reads only a word (ie, stops at the first blank space

 51:     //cout << line << endl;

 52: 
 53:     //char c;

 54:     //cin >> c;

 55:     //cout << (int)c << endl;

 56: 
 57:     //int i = 68;

 58:     //cout << (char)(i + 3) << endl;

 59: 
 60:     int i, j;
 61:     //cout << "\nEnter two integer values: ";

 62:     //cin >> i >> j;

 63:     //cout << "The first value entered was " << i << ".\n";

 64:     //cout << "The second value entered was " << j << ".\n";

 65: 
 66:     //Converting the above four lines into the following two function calls

 67:     GetTwoValuesFromUser(i, j);
 68:     DisplayValues(i, j);
 69: 
 70:     //if (argc == 1)

 71:     //{

 72:     //    DisplayOpeningScreen();

 73:     //    TextItems TEXT("encode_decode.txt");

 74:     //    TEXT.displayItem("ProgramDescription");

 75:     //}

 76: 
 77:     //cout << "\nCarrying on ..." << endl;

 78:     //Pause();

 79: 
 80:     //Can also use Pause() like this ...

 81:     //Pause(10, "Message indented 10 spaces.")

 82: }