Need some assistance please

I'm a beginner with C++ and wonder if someone could assist here.

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

#include <iostream>
#include <string>

using namespace std;

void inputData(string name, string addr1, string addr2, string postalCode);

int main()
{
    string name, addr1, addr2, postalCode;

	cout<<"Enter Name :";
	cin>>name;
	cout<<"Enter P.O. Box Number :";
	cin>>addr1;
	cout<<"Enter Place Name :";
	cin>>addr2;
	cout<<"Enter Postal Code :";
	cin>>postalCode;
	cout<<endl;
{
   void displayData(string name[20], string addr1[20],  string addr2[20], string postalCode);
}
   cout<<name <<endl;
   cout<<addr1 <<endl;
   cout<<addr2 <<endl;
   cout<<postalCode;
   cout<<endl;
}


This is what I've done so far..the program works until I enter a space or full stop.

How do I declare the string values to be anything?
Last edited on
The cin>> reads one word only. No spaces inside.

Use std::getline to read a multi-word text into single std::string.
Topic archived. No new replies allowed.