Question about arrays and data read from a file [string data] [input file]

Q: Lets say I am reading a list of names and their skater 7 possible scores from an . EX:

JohnDoe 7 8 9 0 9 0 9
MissJohnDoe September 8, 1910 9 2 5 9
etc etc etc. . (Note the skater took no spaces, so they can be viewed as a string)

I their equivalent scores (throwing the highest and lowest), declares the winner and the output of all this information to get an output file.

How I of the skaters names of the songs?

C + +


Re:use the stream-extraction operator..
ifstream fi("file");
string name;
int sc[7];
fi >> name >> sc[0] >> sc[1] .. sc[6];

Re:Its C++, sorry

Here is the assignment (http://www.dswann.com/Program5.doc). All I am asking for is help on the input of data.


Re:I think the easiest way would be tokenize the string using the spaces as delimiters.

Re:This might be an alternative:

if ( isalpha(input_char) )
{
statements;
}

if ( isdigit(input_char) )
{
other_statements;
}


Re:By looking for the spaces.

A better answer depends on the language and what functions / libraries you're supposed to be using in your class.


Related posts

Leave a comment

0 Comments.

Leave a Reply


click to changeSecurity Code

[ Ctrl + Enter ]