// Mr. Minich
// Computer Science Using C++
// Ch. 6 Demo Program #1
// January 30, 2000 
// Purpose - to illustrate the use of string variables, cin and cout streams, and input and output operators.

#include <iostream.h>
#include "M:\C++ Programming\AP classes\apstring.h"

int main()
{
	apstring firstName = "John";		// user's first name stored as a string variable
	apstring lastName = "Doe";		// user's last name stored as a string variable
	apstring className;			// an uninitialized string variable that will store the name of the user's class
	char middleInitial;			// an uninitialized char variable that will store the user's middle initial

	cout << "First name is " << firstName << endl;
	cout << "Last name is " << lastName << endl;
	cout << "Student is known as " << firstName << " " << lastName;
// The blank space is added so that the firstName is separated from lastName by one space. cout << "\nWhat class is the student taking? "; // The newline escape sequence \n is used so that this question is on a separate line of output. cin >> className; cout << "What is the student's middle initial? "; cin >> middleInitial; // Hopefully the user will only type one letter since middleInitial is a char variable (and not an apstring) cout << firstName[0] << middleInitial << lastName[0] << " is taking " << className << "." << endl;
// Note how you can break up a line of code around the output // operator <<. The second line should be indented for readability and the first line // must not end with a semicolon. Notice how spaces are intentionally // included at the beginning and end of the string literal " is taking " // so that the output is nicely formatted and the words don't run together. The period symbol is // included so that this sentence is grammatically correct. return 0; }// end of main