首页 > 编程语言 > 详细

C++输入输出知识

时间:2015-09-04 18:39:01      阅读:279      评论:0      收藏:0      [点我收藏+]

1.strtok将字符串中的单词用‘ ‘分割出来

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<fstream>
using namespace std;
int main()
{
    /*
        fstream fin("input.txt",ios::in); fin>>value
        fstream fin("output.txt",ios::out); fin<<value
    */ 
    char p[]="i am a student, you are a student too.";
    char *s=strtok(p," ");
    while(s!=NULL)
    {
        cout<<s<<endl;
        s=strtok(NULL," ");
    }
    
    return 0;
}

输出结果:

技术分享

C++输入输出知识

原文:http://www.cnblogs.com/program-ccc/p/4782108.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!