源自:msdn
Example/* STRTOK.C: In this program, a loop uses strtok
 * to print all the tokens (separated by commas
 * or blanks) in the string named "string".
 */#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some  more tokens";
char seps[]   = " ,\t\n";
char *token;void main( void )
{
   printf( "%s\n\nTokens:\n", string );
   /* Establish string and get the first token: */
   token = strtok( string, seps );
   while( token != NULL )
   {
      /* While there are tokens in "string" */
      printf( " %s\n", token );
      /* Get next token: */
      token = strtok( NULL, seps );
   }
}

解决方案 »

  1.   

    数据的行数不确定
    --------------------------------
    那么最大的行数是多少?
    -----------------------------------
    如果楼主只想使用文件,可以用fstream类来处理 之后使用fseek定位到文件
    至于如何解析就简单多了吧,用楼上的strtok就可以
    如果这都嫌麻烦 就直接用cin空格它就认为是下一个数了
      

  2.   

    我是个新手,请各位高手给出具体程序,具体aa.txt,bb.txt,cc.txt,dd.txt,ee.txt放在哪里.
    谢谢大家了。 
      

  3.   

    使用 CStdioFile::ReadString 来读取文件行
    用 _stscanf 来解析数据
      

  4.   

    用 CStdioFile::ReadString 读取文件行
    用 _stscanf 解析数据
      

  5.   

    俺用fgets来行读,然后按空白符来分。