码迷,mamicode.com
首页 >  
搜索关键字:stdin    ( 2699个结果
2015年天勤考研机试模拟赛 A 判断三角形
【思路】:采用atoi转换长度,两边只和大于第三边,两边之差小于第三边。 【AC代码】: #include #include #include #include using namespace std; #define MAX 100+10 int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w...
分类:其他好文   时间:2015-03-19 00:55:25    阅读次数:139
c/c++重定向输入输出
#define Local#include #include //#include using namespace std;int main(){#ifdef Local freopen("datain.txt","r",stdin); freopen("dataout.txt","r",std.....
分类:编程语言   时间:2015-03-17 15:37:26    阅读次数:147
蓝桥杯 BASIC 30 高精度加法(大数)
【思路】:大数处理都一样。 【AC代码】:代码细节可以美化一下。 #include #include #include #include #include #include using namespace std; #define MAX 100+10 int main() { //freopen("in.txt", "r", stdin); //freopen("out....
分类:其他好文   时间:2015-03-16 23:11:18    阅读次数:252
C语言gets函数,fgets函数的使用
gets从标准输入设备读字符串函数。可以无限读取,不会判断上限,以回车结束读取。函数的具体功能如下所示:从stdin流中读取字符串,直至接受到换行符或EOF时停止,并将读取的结果存放在buffer指针所指向的字符数组中。换行符不作为读取串的内容,读取的换行符被转换为‘\0’空字符,并由此来结束字.....
分类:编程语言   时间:2015-03-15 10:45:31    阅读次数:365
蓝桥杯 BASIC-10~12 进制转化
十进制转十六进制 【AC代码】:更简单采用直接输出的方式。 #include #include #include using namespace std; int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int n = 0, cnt = 0, i = 0; cin ...
分类:其他好文   时间:2015-03-13 22:23:24    阅读次数:178
蓝桥杯 BASIC-7~9 特殊的数字、回文数、特殊的回文数
特殊的数字 【AC代码】: #include #include #include using namespace std; int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int i = 0; for (i = 100; i <= 999; i++) { in...
分类:其他好文   时间:2015-03-10 23:14:12    阅读次数:263
C++中文件的读出及写入
1>在C语言中,我们都知道怎样直接用txt文件输入以及把输出结果直接输出到文件中。写法很简单: freopen("Input.txt","r",stdin); freopen("Output.txt","w",stdout); 是调一个通用的函数freopen,在头文件中,这个函数有三个参数,第一个表示读入或者输出文件的文件名,第二个有两个可选参数,“w”表示write,即写入...
分类:编程语言   时间:2015-03-10 19:29:53    阅读次数:256
C零散_清空缓冲区_错误检测_数字转字符串
1 fflush(stdin) 清空输入缓存区,对于输入类型错误相当有用。例:1 int res, i; 2 while ( fflush(stdin), ( res = scanf("%d", i) ) != EOF ) 3 { 4 } 输入之前将输入缓存区清空,所以当将i错输入成字符时,...
分类:其他好文   时间:2015-03-08 17:02:01    阅读次数:147
sudo非交互式输入密码
我们在使用sudo命令的时候,为了避免交互,可以使用echo‘password‘|sudo-Scmd这样的方式,通过管道传入密码,就不用手动输入了。其中-S的意思是将提示符输入到stderr,并从stdin中读取密码.且密码必须以换行符结尾
分类:其他好文   时间:2015-03-07 18:47:56    阅读次数:678
王道训练营3月7日
1 while(fflush(stdin),scanf("%d %c %d",&num1,&op,&num2))2 //刷新缓冲区,逗号表达式的值取最后一个值,scanf函数返回成功读取的变量个数,失败返回EOF
分类:其他好文   时间:2015-03-07 17:08:36    阅读次数:142
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!