跳到主文
部落格全站分類:寵物日記
從記事本讀入每行的字串後, 我想再分割成數個字串例如, 讀入的字串str為 "R1 R2 R3 R4" , 我想分開成s1="R1", s2="R2", s3="R3", s4="R4"
以下是我的程式
#include<iostream>#include<fstream>#include<sstream>#include<string>using namespace std;
#define SIZE 20char line[SIZE];string str;string s1, s2, s3, s4;
int main(){
fstream input;input.open("c:\input_file.txt",ios::in);while(input.getline(line,sizeof(line),'\n')){
str = line;}
system("pause");return 0;}
This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends:
線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍
xxxmkks 發表在 痞客邦 留言(0) 人氣()