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
|
#include <cstdlib>
#include <cstring>
#include <iostream>
void getInfo(char *street,char *city, char *state, char *zip);
void displayInfo(char *address);
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
char street[30];
char city [20];
char state[3];
char zip[6];
char address[60];
getInfo(street, city, state, zip);
strcpy(address,street);
strcat(address, " ");
strcat(address, city);
strcat(address, " ");
strcat(address, state);
strcat(address, " ");
strcat(address, zip);
displayInfo(address);
return 0;
}
void getInfo(char *street,char *city, char *state, char *zip)
{
cout << "enter your street address: "<< endl;
cin.getline(street,30);
cout << "enter your city"<< endl;
cin.getline(city,20);
cout << "enter your state"<< endl;
cin.getline(state,3);
cout << "enter you zip code"<< endl;
cin.getline(zip, 6);
}
void displayInfo(char *address)
{
cout << " your full address is: "<< address << endl;
}
|