Hi, i'm new to the whole windows form application in C++. I want to make a simple app that prompts the user to enter his name. The app should open a text.txt file and output the corresponding mobile number to that name.
Here is what the .txt file looks like :
Ahmed 01148220333
John 023837427
David 119922248
Here is what an equivalent C++ console code would look like
int main ()
{
ifstream IN;
string Filename, number,name;
cin>>name;
IN.open ("text.txt");
if (IN.fail())
return -1;
IN>>Filename;
while (!IN.eof())
{
IN>>number;
if (Filename==name)
{
cout<<number<<endl;
IN.close();
return 0;
}
IN>>Filename;
}
cout<<"Name does not exist"<<endl;
IN.close();
return 0;
}