I wrote a program that determines what rank the name (popular one is the first) that user entered is.
The problem is that the output is supposed to show rank for both girls and boys at the same time. For example, If I put Justice, the output should be
Justice is ranked 406 among boys.
Justice is ranked 497 among girls.
But my program only shows one of them.
Please tell me what the problem is and what to do to fix it.
Here is the program I wrote.
using namespace std;
cout << "unable to open the file. Please try again." << endl;
cout<< " Please enter the name you want to find.(Make sure to wirte an upper case letter for the first letter of the name.)" << endl;
cin >> name;
int flag = 0;
iss >> word;
} while (iss);
for(i=0; i<3; i++)
if (arr[i] == name)
flag = i;
cout <<name<<" is ranked "<< arr <<" among ";
cout<< "Sorry,"<<name<<" is not ranked in the 1000 "<<endl;