Xuất Các Từ Trên Các Dòng Tương Ứng( Cách 2)

#include<iostream> using namespace std; #include<string> #include<stdio.h> #include<vector> #include<algorithm> int main() { string s="Cuu Long Tranh Ba" ; string::iterator t,t2; vector<string> split; for( t=s.begin();t<s.end();t++) { t2=find(t,s.end(),' '); if(t<t2){ split.push_back(string(t,t2)); //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 //C u u L o n g T r a n h B a a n h chuc t=t2-1; } } for(int i=0;i<split.size();i++) { cout<<split[i]<<endl; } system("pause"); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.