Source of TestStuff61.cpp


  1: //TestStuff61.cpp

  2: //Tuesday, Apr 01, 2014

  3: 
  4: #include <iostream>

  5: #include <fstream>

  6: #include <string>

  7: #include <iomanip>

  8: #include <cstdlib>

  9: using namespace std;
 10: 
 11: #include "utilities.h"

 12: using Scobey::Pause;
 13: 
 14: int main(int argc, char* argv[])
 15: {
 16:         //int a[] = {1, 2, 3, 4, 5};

 17:         //cout << sizeof (a) << endl;

 18:         //int* iPtr = a;

 19:         //cout << *iPtr << endl;

 20:         //iPtr++;

 21:         //cout << *iPtr << endl;

 22:         //a++;  //Can't do this because a is "const"

 23: 
 24:         //int* iPtr = new int[5];

 25:         //cout << sizeof (iPtr) << endl;

 26:         //iPtr[0] = 1;

 27:         //iPtr[1] = 2;

 28:         //iPtr[2] = 3;

 29:         //iPtr[3] = 4;

 30:         //iPtr[4] = 5;

 31:         //for (int i = 0; i < 5; i++)

 32:         //{

 33:         //        cout << iPtr[i] << " ";

 34:         //}

 35:         //cout << endl;

 36: 
 37:         //int a[] = {1, 2, 3, 4, 5};

 38:         //cout << *a << endl;

 39:         //cout << a << endl;

 40: 
 41:         //char s1[] = {'H', 'i'};

 42:         //cout << *s1 << endl;

 43:         //cout << s1 << endl;

 44: 
 45:         //char s2[] = {'H', 'i', '\0'};

 46:         //cout << *s2 << endl;

 47:         //cout << s2 << endl;

 48: 
 49:         //char s3[] = "Hi";

 50:         //cout << *s3 << endl;

 51:         //cout << s3 << endl;

 52: 
 53:         //char s[] = "Hello, world!";

 54:         //cout << s+7 << endl;

 55:         //cout << *(s+7) << endl;

 56: 
 57:     //What is the output of the following code

 58:     //if the command-line input is the following

 59:     //four-word sentence?

 60:     //That thing hardly passes.

 61:         //for (int i = 1; i < argc; i++)

 62:         //{

 63:         //        cout << *(argv[i]+i);

 64:         //}

 65:         //cout << endl;

 66: 
 67:         //for (int i = 1; i < argc; i++)

 68:         //{

 69:         //        cout << argv[i]+i << endl;

 70:         //}

 71: 
 72:         //char s[] = "Hello, world!";

 73:         char* s = "Hello, world!";
 74:         cout << s+7 << endl;
 75:         cout << *(s+7) << endl;
 76: 
 77: }