c++ - Splitting awkward cstring's into different arrays? -


ok, here's deal. project school, , can't use #include < string >. basically, strings we'll dealing with, have use cstrings, or char arrays end null terminator. same thing right? i'm having little bit of trouble. have read in first name, last name, student id, , minimum of 5 grades maximum of 6 grades input file. see looks below, there catch. there can arbitrary amount of spaces in between each of details, maximum length of line being 250. example of input below.

adam zeller 452231     78    86 91   64 90       76 barbara young 274253 88   77  91    66  82     carl wilson 112231       87    77    76   78  77    82 

notice, how there random amounts of spaces in between details. basically, need names (both first name , last name can vary in length), read student id int, , read rest of grades (preferably int array). also, can have either 5 or 6 grades,the program should able handle either. how in world go sorting data? thought maybe getline() cstring char array of whole line, , seperate each bit accordingly each array, don't know how go this. indefinitely, don't want give me code, maybe point me in right direction of how go this. sorting line of data different variables, while accounting either 5 or 6 grades without effecting data, , list 60 lines long (meaning have 60 students on no more that). portion of project, seems 1 part can't past. again, don't want code or direct answers, maybe point me in right direction of way go this. much!

i'm not going post code (as requested), consider filtering each line through strtok. strtok splits string tokens, can arranged or stored like. see here more: http://www.cplusplus.com/reference/cstring/strtok/


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -