Hi
I have an input file that I need to infile into my program:
Joe smith 23
alice west 45
bob MILLS 82
*
45 182 210 43 170 301 -1
82 150 97 -220 178 223 300 -1
I can get the names and the numbers after the names in, but when I get to
the asterisk, the computer thinks * is a string instread of a char, and then it skips 45 and 182 and then I can get 210, 43, etc as int data types, but the 45 and 182 are coming up as string data types.
Here is how I am doing it:
while(infile)
{
if (firstname != "*")
{
infile >> firstname >> lastname >> leagueIDnum;
cout << firstname << lastname << leagueIDnum << endl;
}
if(firstname == "*")
{
infile >> bowlingscores;
cout << bowlingscores << endl;
}
}
I have an input file that I need to infile into my program:
Joe smith 23
alice west 45
bob MILLS 82
*
45 182 210 43 170 301 -1
82 150 97 -220 178 223 300 -1
I can get the names and the numbers after the names in, but when I get to
the asterisk, the computer thinks * is a string instread of a char, and then it skips 45 and 182 and then I can get 210, 43, etc as int data types, but the 45 and 182 are coming up as string data types.
Here is how I am doing it:
while(infile)
{
if (firstname != "*")
{
infile >> firstname >> lastname >> leagueIDnum;
cout << firstname << lastname << leagueIDnum << endl;
}
if(firstname == "*")
{
infile >> bowlingscores;
cout << bowlingscores << endl;
}
}