1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
//ContactCard.cpp
#include <iostream>
#include <string>
using namespace std;
//function prototypes
string firstName = "";
string lastName = "";
string firstInitial = "";
string lastInitial = "";
string streetAddress = "";
string city = "";
string state = "";
string zip = "";
string phone = "";
void displayLine();
void displayInitial();
void displayName();
void displayStreet();
void displayCityStateZip();
void displayPhone();
int main ()
{
//declare variables
cout <<"Enter the customer's first name: ";
getline (cin, firstName, '\n');
cout <<"Enter the customer's last name: ";
getline (cin, lastName, '\n');
cout <<"Enter the customer's street address: ";
getline (cin, streetAddress, '\n');
cout <<"Enter the customer's city: ";
getline (cin, city, '\n');
cout <<"Enter the customer's state: ";
getline (cin, state, '\n');
cout <<"Enter the customer's zip code: ";
getline (cin, zip, '\n');
cout <<"Enter the customer's phone number: ";
getline (cin, phone, '\n');
firstInitial = firstName.substr (1,1);
lastInitial = lastName.substr (1,1);
//display output items
cout << "This is what " << firstName << " " << lastName << "'s contact card will appear.";
cout <<"\n";
displayLine();
displayInitial();
displayLine();
displayName();
displayStreet();
displayCityStateZip();
displayPhone();
displayLine();
return 0;
} //end of main function
//**************function definitions***************
void displayLine()
{
cout <<"****************************************"<< endl;
} //end of displayLine function
void displayInitial()
{
cout <<"********** " << firstInitial << lastInitial << " **********"<<endl;
} //end of displayInitial function
void displayName ()
{
cout <<"********** " << firstName << lastName <<endl;
}//end of displayName function
void displayStreet ()
{
cout <<"********** " << streetAddress << endl;
}//end of displayStreet function
void displayCityStateZip ()
{
cout <<"********** " << city <<", "<< state << " " << zip << endl;
}//end of displayCityStateZip function
void displayPhone ()
{
cout <<"********** " << phone << endl;
}//end of displayPhone function
|