I have been assigned to create a program that is supposed to extract all the data from each row of a file into a struct. Each row in the file contains:
1) A baby name
2) The percent frequency with which that name is assigned to a baby
3) The number of babies with that name
4) A popularity rank
Each row looks something like this: ANNELISE 0.405 1,011,563 14
The trouble I'm having is that my program seems to be unable to get past the first baby name.
UPDATE: It appears that "babyName.number" is not being read correctly. It's the comma's fault!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
usingnamespace std;
struct Record
{
string name;
float percentFrequency;
longint number;
int rank;
};
int main()
{
for (int i = 0; i < 99; i++)
{
Record babyName;
inputStream >> babyName.name >> babyName.percentFrequency >> babyName.number >> babyName.rank;
mbstowcs_s(&returnCode,wcstr,babyName.name.c_str(),MAX_LOADSTRING);
}
return 0;