getline c分格和c++风格
2017-08-14 16:48
190 查看
#include <iostream> using namespace std; #include <string> int main() { string str; char buf[20]; cout << "input a line" << endl; getline(cin, str); cout << "str=" << str << endl; cout << "input a line <20" << endl; cin.getline(buf, 20); cout << "buf=" << buf << endl; if (!cin) { cout << "read erro state" << endl; } int n; cout << "input an integer" << endl; cin >> n; cout << "n=" << n << endl; return 0; }
相关文章推荐
- C++:关于string转C-风格字符串
- C++风格_格式
- C风格类型的字符串在C++中的应用
- Google C++ 风格指南 - 中文版
- C风格字符串和C++的标准库类型string的比较
- C++代码风格与规范
- Bjarne Stroustrup的FAQ:C++的风格与技巧
- 字符串字面值、C风格字符串、C++风格字符串
- C++程序风格的思考
- Google放出C++代码风格规范
- 学习opencv(2)---opencv中C风格和C++风格函数区别
- ubuntu设置vim语法高亮显示和自动缩进 (windows风格的C/C++自动缩进)
- C++风格的文件输入输出流
- C++风格的类型转换的用法
- 现代C++风格的新元素
- c++基于对象的编程风格
- 一图看完谷歌C++风格
- Android JNI(五)————JNI_JNI函数编码风格(C风格与C++风格)
- 现代C++风格的新元素
- Android Studio修改大括号位置,修改括号为C/C++风格