#include<fstream.h>
#include<stdio.h>
void main()
{
char name[20];
int marks;
char c;
ofstream fwrite("vin.txt");
cout<<"Enter name: ";
cin.getline(name,20);
cout<<"Enter marks: ";
cin>>marks;
fwrite<<name;
fwrite<<marks<<endl;
cout<<"Enter name: ";
fflush(stdin);
cin.getline(name,20);/**problem...compiler skips this statement...**/
cout<<"Enter marks: ";
cin>>marks;
fwrite<<name;
fwrite<<marks<<endl;
}
if i use cout instead of getline..the statement is executed...and also the first getline statement isnt skipped.
What might be the reason??