码迷,mamicode.com
首页 >  
搜索关键字:getline    ( 561个结果
为什么getline()后要两次回车????(将输入的字符串按单词倒序输出)
#include#include#includeusing namespace std;int main(){ string s; getline(cin,s); int len=s.size(); for(int i=len-1;i>=0;i--) { if(s[i]==' ') { st...
分类:其他好文   时间:2015-05-14 00:38:43    阅读次数:108
在终端输入多行信息,找出包含“ould”的行,并打印改行
#include #include #define MAX 1000 //读取字符串函数 int getline(char line[],int max)//max为数组剩余长度 { char ch; int i=0; while(max>0 && (ch=getchar())!=EOF && ch!='\n') { line[i]=ch;//读取字符放到数组Line中 i++;...
分类:其他好文   时间:2015-05-11 21:54:48    阅读次数:188
用指定字符串(如%20)替换空格 时间复杂度为O(n)
#include #include using namespace std;void ReplaceBlank(char* destr, const char* sostr, int sLen);int main(){ string sostr = ""; getline(cin, sostr); ...
分类:其他好文   时间:2015-05-11 21:21:55    阅读次数:243
C++常用的输入函数总结
主要的输入输出函数有6种:cin, cin.get() , cin.getline() ,getline() , gets() ,getchar()cin(1)根据变量的类型读取数据结束条件:回车键、空格键、TAB结束符的处理:缓冲区中丢弃使输入结束的结束符(回车键、空格键、TAB)#include...
分类:编程语言   时间:2015-05-10 23:42:42    阅读次数:218
输入流
本文介绍了cin重载的operator>>()函数、get()函数、getline()函数以及相应的eofbit和failbit问题。 cin重载了operator>>()函数来实现对任何类型数据的输入操作,重载的类型如下: int& short& long& unsigned int& unsig...
分类:其他好文   时间:2015-05-10 15:31:22    阅读次数:178
输入字符串判断是否含有“ould”
#include #include #include #define MAX 1000 int getline(char line[], int max) { int ch; int i = 0; while (max > 0 && (ch = getchar()) != EOF && ch !=...
分类:其他好文   时间:2015-05-09 16:33:33    阅读次数:117
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I strutss
root causejava.lang.NoSuchMethodError: antlr.collections.AST.getLine()I org.hibernate.hql.ast.HqlSqlWalker.generatePositionalParameter(HqlSqlWalker.ja...
分类:编程语言   时间:2015-05-07 12:01:01    阅读次数:250
C++ Primer第四版习题--3.10
#include #include #include int main() { std::string str, result_str; bool flag=false; while(getline(std::cin, str)) { for(unsigned index=0; index<str.size(); ++index) ...
分类:编程语言   时间:2015-05-06 11:02:08    阅读次数:159
HDU 4054 Hexadecimal View 模拟
戳这里:HDU 4054//复习一下 cin.getline() 的用法 1 #include "bits/stdc++.h" 2 using namespace std; 3 char str[5000]; 4 5 char Change(char c) 6 { 7 if('A' <= ...
分类:其他好文   时间:2015-05-04 01:13:18    阅读次数:189
模拟 ZOJ 3878 Convert QWERTY to Dvorak
题目传送门 1 /* 2 模拟:手敲map一一映射,累! 3 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #in...
分类:其他好文   时间:2015-04-26 15:09:00    阅读次数:204
561条   上一页 1 ... 44 45 46 47 48 ... 57 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!