<C++ Primer_5th>习题_3.2
来源:互联网 发布:淘宝立体3d服装制作 编辑:程序博客网 时间:2024/05/16 16:30
//编写一段程序从标准输入中一次读取一整行,然后修改该程序使其一次读入一个词。#include<iostream>#include<string>using namespace std;int main( ){string line;//提示用户输入字符串,直至文件结束或遇到异常输入cout << " 请输入你的字符串,可以包括空格: " << endl;//使用getline()函数来读取一行字符串,并判断输入流是否正确while (getline(cin, line))cout << line << endl;system("pause");return 0;}//使用cin一次读入一个单词,遇到空白为止#include<iostream>#include<string>using namespace std;int main( ){string word;//提示用户输入单词cout << "请输入您的单词,不可以包含空格: " << endl;//使用cin读入一个单词,遇到空白为止,并判断输入流是否正确while (cin >> word)cout << word << endl;system("pause");return 0;}
阅读全文
0 0
- <C++ Primer_5th>习题_3.2
- <C++ Primer_5th>习题_3.3
- <C++ Primer_5th>习题_3.4
- <C++ Primer_5th>习题_3.5
- <C++ Primer_5th>习题_3.6
- <C++ Primer_5th>习题_3.10
- <C++ Primer_5th>习题_3.14
- <C++ Primer_5th>习题_3.16
- <C++ Primer_5th>习题_3.17
- <C++ Primer_5th>习题_3.20
- <C++ Primer_5th>习题_3.22
- <C++ Primer_5th>习题_3.23
- <C++ Primer_5th>习题_3.24
- <C++ Primer_5th>习题_3.25
- <C++ Primer_5th>习题_3.31
- <C++ Primer_5th>习题_3.35
- <C++ Primer_5th>习题_3.36
- <C++ Primer_5th>习题_1.3
- 爬虫笔记(9/30)---------爬虫伪装技术
- 杂谈Android身份证识别技术
- Rust : codewars的up AND down 算法
- Ubuntu 安装 Docker
- linux磁盘分区,挂载磁盘,以及卸载磁盘
- <C++ Primer_5th>习题_3.2
- java任务--Volume
- 调整数组顺序使奇数位于偶数前面
- gcc -c
- Protocol Buffers的学习笔记
- jsp实现登录验证的过滤器
- <C++ Primer_5th>习题_3.3
- Java多线程CountDownLatch的使用
- ubuntu16.04 安装pycharm