Wednesday, 26 August 2015
This Program Will take Input from Files. Now When a user enter a Name Then This program will Search that name in the files Stored in the Computers Hard Drive. If Found Then It will show the message That It's a Boy name Else Vice Versa.
void main()
{
char choice='Y';
do
{
int i,k;
string std,test;
cout<<"Please The First Letter Should Be A CAPITAL CASE.\n\n";
cout<<"Now Enter Your Name : ";
cin>>test;
if(test[0]=='A')
{
ifstream input("F:\\database\\A.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
/*/////////////////////// FOR B,D,F,G,H,I \\\\\\\\\\\\\\\\\\\\\\\*/
if(test[0]=='B' || test[0]=='D' || test[0]=='F' || test[0]=='G' || test[0]=='H' || test[0]=='I')
{
ifstream input("F:\\database\\BDFGHI.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
/*/////////////////////////// FOR J,K,L,M \\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
if(test[0]=='J' || test[0]=='K' || test[0]=='L' || test[0]=='M')
{
ifstream input("F:\\database\\JKLM.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
/*/////////////////////// FOR N,O,P,Q,R \\\\\\\\\\\\\\\\\\\\\\\*/
if(test[0]=='N' || test[0]=='O' || test[0]=='P' || test[0]=='Q' || test[0]=='R')
{
ifstream input("F:\\database\\NOPQR.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
/*/////////////////////////// FOR S,T \\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
if(test[0]=='S' || test[0]=='T')
{
ifstream input("F:\\database\\ST.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
/*/////////////////////// FOR U,V,W,Y,Z \\\\\\\\\\\\\\\\\\\\\\\*/
if(test[0]=='U' || test[0]=='V' || test[0]=='W' || test[0]=='Y' || test[0]=='Z')
{
ifstream input("F:\\database\\UVWYZ.txt");
while(!input.eof())
{
getline(input,std);
i = std.find(test);
if(i==0)
{
cout<<"\n\nYes! It is A Boy Name.\n\n";
k=0;
}
}
if(k!=0)
{
cout<<"Sorry!\n\n";
cout<<"Eighter It Is A Girl Name.\n\nOr\n";
cout<<"\nMay be You Entered The Wrong Spelling.\n";
cout<<"\nPlease Try Again.\n\n";
}
}
cout<<"Enter Your Choice:\n\n";
cout<<"If You Want To Carry On Then Enter Y\n\n";
cout<<"Else If You Want To Brake Then Press N\n\n";
cin>>choice;
}
while(choice!='N');
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment