#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream readfile; readfile.open("八卦图数据源.txt"); string str; string oldstr=""; do{ readfile>>str; if(str==oldstr){ break; } oldstr=str; cout<<str<<" x:"<<str.substr(0,str.find(":"))<<" z:"<<str.substr(str.find(":")+1)<<endl; }while(str.size()>2&&str.find(":")>0&&str.find(":")<str.size()); return 0; }
标签:分割,string,oldstr,readfile,str,字符串,include,find From: https://www.cnblogs.com/As198601/p/16748218.html