C_string program help assign whole string to address??

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);

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
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.
Topic archived. No new replies allowed.