Sep 15, 2012 at 3:08am UTC
It reads in info fine just when the getInfo function finishes use c_string library functions to concatenate the values held in street, city, state, zip and assign the whole string to address. in main()
im not sure how to do that.
#include <iostream>
#include <string>
using namespace std;
void getInfo(char street[], char city[], char state[], char zip[]);
void displayAddress(char address[]);
int main()
{
char street[30];
char city[20];
char state[3];
char zip[6];
char address[60];
getInfo(street, city, state, zip);
displayAddress(address);
system("pause");
return 0;
}
void getInfo(char street[], char city[], char state[], char zip[])
{
cout << "Enter your street address: ";
cin.getline(street, 30);
cout << "Enter your city: ";
cin.getline(city, 20);
cout << "Enter your state (2 digits): ";
cin.getline(state, 3);
cout << "Enter your 5-digit zip code: ";
cin.getline(zip, 6);
}
void displayAddress(char address[])
{
}
Last edited on Sep 15, 2012 at 3:08am UTC
Sep 15, 2012 at 5:58am UTC
You will probably have to first do a strcpy() into the address and then do strcat() for the rest so that address stores your entire string.