C++ ignore function.

HI All... well am new in programming, so I need help to learn programming. and I hope I will get my ans here...
well I wanna to get user name, hid first and last name, so for this purpose am using getline function, also ignore function for ignoring new line character,
so after getting user name when it show out put, it ignore the first character,
I mean if user enter "Omii" , then it will output "mii" , it will ignore "O" its self . so how to solve this, ...
here is my 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
                        cout<<"\n\n\n Enter The Name Of Employee:  ";
			cin.ignore();
			cin.getline(name,30);
			
		        cout<<" Enter The Employee ID:   ";
	                cin.ignore();
		 	cin.getline(employe_ID,20);
	        
			
		        cout<<" Joining Date Of Employee: (DD/MM/YYYY)  ";
			cin.ignore();
			cin.getline(joining_DATE,20);
			
			
			cout<<" Enter The Position Of Employee:  ";
		        cin.ignore();
			cin.getline(position,20);
		    
				
	                cout<<" Enter Maritial Status Of Employee:  ";
			cin.ignore();
			cin.getline(marital_status,10);
			
			
			cout<<" Enter The Age Of Employee:  ";
		        cin.ignore();
			cin.getline(age,10);
		   
		
			cout<<" Enter The Salary Of Employee: AED  ";
		        cin.ignore();
			cin.getline(salary,20);
		    
				
			cout<<" Any Comment About Employee:  ";
			cin.ignore();
		       cin.getline(comment,80);



thank you in advance...!!
Regards Omii!!!
remove the cin.ignore(); statements. getline calls don't leave behing '\n' characters.
I try this too.... but its print 2nd line , and didn't wait for user input...
The cin.ignore() statements on lines 6, 11, 16, 21, 26, 31 and 36 must go.

Whether the one one line 2 is necessary depends on what comes before.
thank you cire...!!! its work... :)
Topic archived. No new replies allowed.