/*******************************************************/
//R.A. Hillyard
//classIntro1.cpp
//Last Modified 11/11/2001
//
// class with member variables and member functions
// for input and output
/*******************************************************/
#include<iostream>
#include<string>
using namespace std;
class Name //class definition goes before main
{
public:
//member functions
void output();
void input();
//member data variables
string first;
string last;
};
int main()
{
Name name1, name2, name3; //declare 3 objects of type Name
name1.input();
name2.input();
name3.first = "Analog";
name3.last = "Device";
name1.output();
name2.output();
name3.output();
return 0;
}
/************************************************/
void Name::output()
{
cout << first + " " + last << endl;
}
/************************************************/
void Name::input()
{
cout << "Enter a first name and last name: ";
cin >> first >> last;
}
/************************************************/
/**************Program Output********************/
Enter a first name and last name: Bob Dingle
Enter a first name and last name: Jill Kelly
Bob Dingle
Jill Kelly
Analog Device