#include <iostream>
#include <fstream>
#include <string>
using namespace std;
main(){
char citylist[]="3 0 0 6,4 300 3 9,5 250 2 11,8 200 3 14,";
int j=0;
char *onecityptr=NULL;
cout<<"现在拆第"<<j<<"个结构体"<<endl;
onecityptr = strtok(citylist,",");
cout<<"第"<<j<<"个结构体为串:"<<onecityptr<<endl;
while(onecityptr!=NULL)
{
cout<<"工作指针还未到该列表的末尾"<<endl;
cout<<"现在拆第"<<j<<"个结构体"<<endl;
onecityptr = strtok(citylist,",");
cout<<"第"<<j<<"个结构体为串:"<<onecityptr<<endl;
}
system("pause");
return 0;
}
#include <fstream>
#include <string>
using namespace std;
main(){
char citylist[]="3 0 0 6,4 300 3 9,5 250 2 11,8 200 3 14,";
int j=0;
char *onecityptr=NULL;
cout<<"现在拆第"<<j<<"个结构体"<<endl;
onecityptr = strtok(citylist,",");
cout<<"第"<<j<<"个结构体为串:"<<onecityptr<<endl;
while(onecityptr!=NULL)
{
cout<<"工作指针还未到该列表的末尾"<<endl;
cout<<"现在拆第"<<j<<"个结构体"<<endl;
onecityptr = strtok(citylist,",");
cout<<"第"<<j<<"个结构体为串:"<<onecityptr<<endl;
}
system("pause");
return 0;
}