码迷,mamicode.com
首页 >  
搜索关键字:getchar    ( 2598个结果
C语言:关注EOF
EOF是指文件的结束符,是一个宏定义 借助于getchar 与putchar 函数,可以在不了解其它输入/输出知识的情况下编写出数量惊人的有用的代码。最简单的例子就是把输入一次一个字符地复制到输出,其基本思想如下:读一个字符while (该字符不是文件结束指示符)输出刚读入的字符读下一个字符将上述基...
分类:编程语言   时间:2015-01-13 01:22:33    阅读次数:185
getchar()、putchar()、gets()、puts()、cin.get()、cin.getline()、getline()
1.getchar:原型为int getchar(void).它从stdin里读取一个字符。返回值为用户输入的ASCⅡ码,出错返回-1。eg:c=getchar().2.putchar:原型为unsigned int putchar(char).在stdout上输出一个字符。当输出正确的时候,返回输...
分类:其他好文   时间:2015-01-11 17:44:42    阅读次数:223
高精度乘法
#include #include int main(){ char a[101],b[101]; int i,j,k,cas,count=1,num2,num3; scanf("%d",&cas); getchar(); while (cas--) { ...
分类:其他好文   时间:2015-01-09 20:45:02    阅读次数:117
6754 Keyboard of a Mobile Telephone
/*实践再次说明ch=getchar()的速度非常慢*//*大水题,不解释*/#include#includeint main(){ int i,j,n,count; int a[150]; char ch,s[210]; j=1; for(i=97; i3) j=1;...
分类:其他好文   时间:2015-01-07 23:18:22    阅读次数:142
1.7第五天
问题:练习一的scanf输入很杂,多多看看getchar,scanf区别!哪些函数在#include来着假定你要判断的三个变量分别为a,b,c,那么这三个变量的最大值用以下表达式表示:x=a>b?(a>c?a:c):(b>c?b:c);可以理解成分支结构等于 继续 用= 搞得我调了半天==感觉状态不...
分类:其他好文   时间:2015-01-07 18:18:41    阅读次数:125
【模拟】bzoj2295 【POJ Challenge】我爱你啊
#include#includeusing namespace std;int n;char s[100001],table[]="luvletter";int main(){ scanf("%d",&n); getchar(); for(;n;--n) { gets(s); int...
分类:其他好文   时间:2015-01-06 11:28:24    阅读次数:152
cin/cin.get()/cin.getline()/getline()/gets()/getchar()
1、cin>>           用法1:最基本,也是最常用的用法,输入一个数字: #include using namespace std; main () { int a,b; cin>>a>>b; cout<<a+b<> 是会过滤掉不可见字符(如 空格 回车,TAB 等)  cin...
分类:其他好文   时间:2015-01-06 10:03:14    阅读次数:144
UVa 455 最小重复字符串
背景:因为一个输出之间间隔一个空行,wa了几次........ #include #include int main(void){ int t; char str[85]; scanf("%d",&t); while(t--){ getchar();getchar(); scanf("%s",str); int i=1,n=strlen(str); for...
分类:其他好文   时间:2015-01-05 15:00:40    阅读次数:165
华为机试—去掉最大值、最小值后剩下的个数
输入一串数,以','分隔,输出所有数中去掉最大值、最小值之后剩下的个数。(其中最大值与最小值可能有多个) Sample input: 3,3,5,3,6,9,7,9  Sample output:  3 #include int main() { int n,i=0; int a[100]; scanf("%d",&n); while(getchar(...
分类:其他好文   时间:2015-01-01 14:50:58    阅读次数:220
【线段树】bzoj3038 上帝造题的七分钟2 / bzoj3211 花神游历各国
暴力修改,记录一段是否全部为1或0,若全是了,则不再修改。注意3211一定要判是否为0,否则会T得惨无人道。#include#includeusing namespace std;#define lson rt'9';c=getchar())if(c=='-')f=-1; for(x=0;c>...
分类:其他好文   时间:2014-12-27 23:05:33    阅读次数:258
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!