#include <iostream> #include <string> using namespace std; int main(int argc, char** argv) { string str = "a:=3;b:=4;c:=5"; for(int i = 1;i<=3;i++){ int startIndex = str.find(";"); string a = str.substr(0,startIndex); a = a.substr(a.find("=")+1,a.size()); str = str.replace(0,startIndex+1,""); cout<<a<<" "; } return 0; }
标签:std,P1597,洛谷,int,include,刷题 From: https://www.cnblogs.com/wangyihang/p/16839629.html