cin.getline(not, working) >:o

hey guys here the code:

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
void the_name()
{
	
	char name[80], address[80], city[80];
	string state;
	int zip, phone;

	
	
	cout << "Mr. Smith wants to know your name: ";
	cin.ignore(80, '\n');
	cin.getline(name, 80);

	
	cout << "In what city can Mr. Smith find you in:";
	cin.ignore(80, '\n');
	cin.getline(city, 80);
	
	cout << "What zip should Mr. Smith put on a letter to you: ";
	cin>>zip;
	
	cout << "Mr. Smith has your zip, now he needs your address: ";
	cin.ignore(80, '\n');
	cin.getline(address, 80);

	
	cout << "How about your state now for Mr. Smith:(Initials Please) ";
	cin>>state;
	
	
	cout << "Mr. Smith wants to prank call you, provide your digits: ";
	cin>>phone;
	
	cout<<" "<<endl<<endl;
	cout<<"Thank you for providing me, I mean, Mr. Smith with the following information:"<<endl;
	cout<<"*****************************************************************************"<<endl;
	cout<<"**	Name:	"<<name<<											         "**"<<endl;
	cout<<"**	City:	"<<city<<															  "**"<<endl;
	cout<<"**	State:	"<<state<<"															  **"<<endl;
	cout<<"**	Zip Code:"<<zip<<"															  **"<<endl;
	cout<<"**	Address:"<<address<<"															  **"<<endl;
	cout<<"**	Phone Number:"<<phone<<"													  **"<<endl;
	cout<<"*****************************************************************************"<<endl;
	
}


it all works EXCEPT for city, after entering a city, you have to hit enter twice then the code will continue, and no matter what you enter for a city name, nothing will be printed. everything else works. any ideas?
if you delete line 16 and convert the line 17 to
1
2
cin.getline(city, 80,'\n');
 
,your problem is solved and if you want ,you can change the other lines like this.
Topic archived. No new replies allowed.