Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
Ever want to impress your boss or that special someone?

Learn the basics of wine tasting from glassware to history to tasting techniques in this online course. This is a course you're sure to enjoy!
From our sponsors
C++ 分割字串
Sep 30th 2013, 23:00

從記事本讀入每行的字串後, 我想再分割成數個字串
例如, 讀入的字串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 20
char 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:

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 sdfgdf2 的頭像
    sdfgdf2

    中文名字日文翻譯, 中文翻譯日文名字, 名字日文翻譯, 日文翻譯名字, 日文翻譯字典發音, 日文翻譯網 漢字,

    sdfgdf2 發表在 痞客邦 留言(0) 人氣()