i have written this code for a phone directory for entering data of 5 persons when i use "cin>>" then my program works but when i use cin.getline then my program does not works
after one menu it does not repeat menu for input just display messages 4 times simultaneaously
Code:# include <iostream> # include <conio.h> using namespace std; struct directory { long int phone_number; char name[50]; };//end struct int main () { directory a[5]; for (int i=1;i<=5;i++) { cout<<"enter name of a person: "<<endl; cin.getline(a[i].name,50); cout<<"enter phone number of person: "<<endl; cin>>a[i].phone_number; }//end for getch (); }//end main