01 2019 档案

摘要:#include <stdio.h>int main(void){ FILE*file; file = fopen("C:\\test.txt","a"); if(!file){ printf("文件打开失败!"); } fputs("\n大时代 123456989",file); system(" 阅读全文
posted @ 2019-01-28 14:44 指遥 阅读(148) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string.h>int main(void){ char a[256]; int len,n,i,tem; printf("请输入:\n"); gets(a); printf("%s\n",a); len = strlen(a); n=len/2 阅读全文
posted @ 2019-01-25 11:39 指遥 阅读(181) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(void){ FILE*file; file = fopen("C:\\test","r"); if(!file){ //等效于:file ==NULL printf("打开文件成功!"); }else{ printf("打开文件失败!"); }  阅读全文
posted @ 2019-01-24 15:07 指遥 阅读(2202) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(void){ int n; int i; int num1,num2; int val; printf("请输入斐波那契数列长度:"); scanf("%d",&n); if(n<0){ printf("数值不存在!"); }else if(n== 阅读全文
posted @ 2019-01-24 14:55 指遥 阅读(360) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void){ int a; int b; for(a=1;a<=9;a++){ for(b=1;b<=a;b++){ printf("%d×%d=%d\t",b,a,a*b); } printf("\n"); } return 0;} 阅读全文
posted @ 2019-01-22 13:23 指遥 阅读(163) 评论(0) 推荐(0)
摘要:/*遇到问题:1、编译过程中无法编译,需要用C99,解决方法: -std=c99 2、for循环:不加分号“;”,写错编译器可以通过编译但输出数据和理想中不符合 错误写法:for(;;;);{ } 正确写法:for(;;;){ } */ #include <stdio.h>int main(void 阅读全文
posted @ 2019-01-22 13:07 指遥 阅读(675) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <windows.h>int main(void){ int a; //定义一个整数型变量 for(a=1;a<8;a++){ printf("天上有%d颗星星!\n",a); Sleep(1000); //休眠1000毫秒=1秒,Windows 阅读全文
posted @ 2019-01-20 21:19 指遥 阅读(244) 评论(0) 推荐(0)
摘要:#include <stdio.h>//打印成绩//0-59,不及格//60-79,及格//80-94,良好//95-100,优秀//其他,非法数据int main(void){ int score; //这个是int整数型,定义char型会出错 //加了while(1)函数,无限循环,按“ctrl 阅读全文
posted @ 2019-01-20 20:04 指遥 阅读(178) 评论(0) 推荐(0)
摘要:1、编译过程中无法编译,需要用C99,解决方法: -std=c99 2、for循环:不加分号“;”,写错编译器可以通过编译但输出数据和理想中不符合 错误写法:for(;;;);{ } 正确写法:for(;;;){ } exercise.c:13:24: warning: comparison bet 阅读全文
posted @ 2019-01-20 19:37 指遥 阅读(133) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void){ int tmp; printf("今天的天气是多少度?\n"); scanf("%d",&tmp); if(tmp>16 ){ printf("出行!\n"); } return 0;} #include <stdio.h>#inc 阅读全文
posted @ 2019-01-19 14:08 指遥 阅读(254) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void){ int xc; int zv; printf("请输入 :"); scanf("%d",&xc); printf("请输入:"); scanf("%d",&zv); if (xc >= 100 && zv >= 10) { prin 阅读全文
posted @ 2019-01-14 13:52 指遥 阅读(135) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h>int main(void){ char min[32] = "love"; char mic[32]; int ad; printf("请输入:"); fgets(mic,sizeof(mic),stdin); ad = s 阅读全文
posted @ 2019-01-14 13:28 指遥 阅读(180) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h>int main(void){ char min[32] = "love"; char mic[32]; int ad; printf("请输入:"); gets(mic); //通过顺序比较,通过的ASCII码大小来判断输出 阅读全文
posted @ 2019-01-13 21:25 指遥 阅读(199) 评论(0) 推荐(0)
摘要:/*1-2-1-19 优化-程序进行中 此次优化加入了,while(1)循环,system(“cls”)终端清屏指令,system(“pause”)终端暂停指令*/ #include <stdio.h> int main(void){ char admin[32] = "amdin"; char p 阅读全文
posted @ 2019-01-13 20:55 指遥 阅读(956) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void)/*通过数组来实现5个整数的平均值*/{ int data[64]; float average; printf("请输入5个整数:"); scanf("%d%d%d%d%d",&data[0], &data[1],&data[2],& 阅读全文
posted @ 2019-01-11 12:41 指遥 阅读(1368) 评论(0) 推荐(0)
摘要:C语言: 1、printf 标准输出; 2、scanf 标准输入; 3、char 字符型 %c; int 整型 %d; float 单精度 %f; 4、gets 输入; 5、fgets 输入,防止输入越界; 6、if语句(如果……) 7、while(1){ 条件…… } /*#include <st 阅读全文
posted @ 2019-01-10 14:15 指遥 阅读(119) 评论(0) 推荐(0)
摘要:/*#include <string.h> 1、strlen 计算字符串长度; 2、strcop 拷贝; 3、strncop 拷贝指定数量的字符; 4、shrcat 连接字符串;*/ #include <stdio.h>#include <string.h>int main(void){ char 阅读全文
posted @ 2019-01-10 14:10 指遥 阅读(291) 评论(0) 推荐(0)
摘要:/*scanf输入的数据中有’空格‘或’回车符‘的时候编译器只执行到空格或回车符之前的数据。 gets输入可以执行有空格或回车符的数据,但数据超过输入限制编译器也不会提示,用gets输入容易越界输入。 fgets输入可以防止越界输入。 #include <stdio.h>int main(void) 阅读全文
posted @ 2019-01-09 13:03 指遥 阅读(625) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main(void) { char my[ ]="love"; printf("my %s",my); return 0;} #include <stdio.h>int main(void){ char my[7]; my[0]='l'; my[1]=' 阅读全文
posted @ 2019-01-08 13:21 指遥 阅读(255) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void){ int a[8]={1,3,5,7,9,2,4,6}; printf("%d,%d,%d,%d,%d,%d,%d,%d", a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]); return 0;} # 阅读全文
posted @ 2019-01-07 14:12 指遥 阅读(295) 评论(0) 推荐(0)
摘要:1、cmd命令指示符窗口运用的:dir 查看当前目录下的文件,cls 清屏,cd c:\程序 切换到C盘程序文件 2、电脑运用:win+D 所有打开的窗口全部缩小,显示桌面。 阅读全文
posted @ 2019-01-07 14:06 指遥 阅读(90) 评论(0) 推荐(0)
摘要:#include <stdio.h>int main(void){ char a; char red; printf("请输入一个小写字母:"); scanf("%c",&a); red = a - 32; printf("%c的大写字母是:%c",a,red); return 0; } ***** 阅读全文
posted @ 2019-01-05 19:35 指遥 阅读(443) 评论(0) 推荐(0)
只有注册用户登录后才能阅读该文。
posted @ 2019-01-05 11:56 指遥 阅读(3) 评论(0) 推荐(0)