after the program runs the first time, it always skip the gets(name[i]), anyone can tell me where i went wrong?
Code:
#include<iostream>
#include <fstream>
using namespace std;
char name[41][40], dob[41][20], sch[41][100],tel[41][15], add[41][100];
char FileName[20], reply,b;
int i,j,Y,z;
int y;
int show( int y);
main ()
{
for (i=1; i<=41 ; i++ )
{
for (z=i; z <=1; i++){
cout << "\nEnter the name of the file to create (e.g file.txt or file.doc , etc) : \n";
gets( FileName);
z=2;
}
system("cls");
cout<<"Name : ";
gets(name[i]);
cout<<"\nTelephone number : " ;
gets(tel[i]);
if(!*name[i]&& !*tel[i]) break;
cout<<"\nDate of Birth : " ;
gets(dob[i]);
cout<<"\nAddress : " ;
gets(add[i]);
cout<<"\nSchools : " ;
gets(sch[i]);
cout << "\n\nName \t: \t" << name[i];
cout<<"\ntelephone \t: \t" << tel[i];
cout<<"\nDate of Birth \t: \t" << dob[i];
cout<<"\nAddress \t: \t" << add[i];
cout<<"\nSchools \t: \t" << sch[i];
cout<< "\n\nSafe to \""<<FileName<<"\"? <Y/N>";
cin>> reply;
if(reply =='Y' || reply =='y')
{
ofstream Students(FileName, ios::app);
Students << "\n\n\nName \t: \t" << name[i];
Students<< "\ntelephone \t: \t" << tel[i];
Students<<"\nDate of Birth \t: \t" << dob[i];
Students<<"\nAddress \t: \t" << add[i];
Students<< "\nSchools \t: \t" << sch[i];
}
}
}