- 博客(30)
- 收藏
- 关注
原创 链表基础2(实现链表的逆序、将新结点插入到特定位置、边插结点边排序)
1、实现链表的逆序、将新结点插入特定位置 #include #include #define SIZE 3 struct node { int num; struct node * next; }; typedef struct node Node; typedef struct node * Link; void create_link(Li
2017-02-09 23:43:25
675
原创 链表基础1
1、建立基本链表结构的程序 #include #include #define SIZE 5 struct node //建立结构体 { int num; struct node * next; }; typedef struct node Node; typedef struct node * Link; void c
2017-02-08 23:40:43
309
原创 数组程序练习
1、找出字符串中的最长数字串 #include int main() { char str[100]; int i; int flag = 0; int loct = 0,loct_long = 0; int len = 0,len_long = 0; printf("Please input a string:\n"); scanf("%s",str);
2017-02-07 20:56:06
712
原创 指针函数的返回
一、返回值为指针的函数 格式:类型 * 函数名(形参列表) e.g int * a(int x,int y) 说明:*函数名两侧不能加括号,由于括号的优先级比*高。首先a与其后参数结合,表明a是函数名,然后与*结合,表明是一个指针形函数。
2017-02-06 22:31:06
318
原创 调用形参为数组的函数的程序
1、 编写函数int stat(int a[],int n,int c[][2])。a指向的数组中保存了由n个1位整数组成的数列(n为偶数)。函数从前至后依次将a数组中每两个相邻元素拼成一个不超过2位的整数,从而生成有n/2个元素组成的整数数列;统计该数列中不同整数各自出现的次数,并将统计结果保存到c指向的二维数组中。函数返回不同整数的个数。 #include void stat(int
2017-02-05 20:44:27
2102
原创 位运算应用
位运算(针对整型、字符型,计算机会将它转换为二进制运算) 1、按位与:x&y 对应位都为1时才为1 用途:取、保留1个数的某位(对应掩码的对应位为1),其余各位置1 2、按位或:x|y 对应位都为0才为0,否则为1 用途:将1个数的某些位置1,其余不变 3、按位异或:x^y 对应位相同为0,不同为1 用途:使1个数某些位取反 4、按位取反:~x
2017-02-05 20:22:15
302
原创 0123程序练习
1、计算字符串中的单词数。 单词:由空格分开的连续字母数字串。 #include char * mygets(char *str) { int i = 0; while((str[i] = getchar()) != '\n') { i++; } str[i] = '\0'; } int main() { int word_n=0;
2017-01-23 23:49:11
355
原创 0122程序练习
1、打印菱形星号组合 #include int p_black(int,int); int main() { int i; int n; int m=1; int flag=0; char ch='*'; for(i=1;i { flag=p_black(i,flag); for(n=1;n { printf("%c",ch); } if(f
2017-01-22 21:47:59
279
原创 0121程序练习
1、求第n个斐波那契数。 #include int main() { int n; inti; intf_num[100]; f_num[0]=0; f_num[1]=1; printf("Pleaseinput a num(q to quit): ");
2017-01-22 10:50:28
251
原创 0120程序练习
1、将输入数的倒序的数输出。 #include int main() { int n; int i=0; int j=0; printf("Please input a num: "); scanf("%d",&n); while(n!=0) { i=n%10; n=n/10; j=j*10+i; } printf("%dgnosgnos
2017-01-20 20:59:11
476
原创 Linux常用文本编辑器vi的命令介绍
1、vi的基本模式: (1)命令行模式:控制屏幕光标的移动,字符、字或行的删除,移动复制某区段及进入插入行模式或者底行模式。 (2)插入模式:只有在插入模式下,才可以输入文字,按【ESC】键可返回命令行模式。 (3)底行模式:将文件保存或退出vi,也可以设置编辑环境,如寻找字符串、列出行号等。 2、vi的基本操作(在命令行模式下!): (1)删除
2017-01-19 19:44:25
388
原创 Linux下的编译器gcc的介绍
1、gcc的主要作用:.c文件→可执行文件 2、gcc的编译过程: (#)预处理(产生.i文件):文件包(文件内容代替include)、宏定义(简单的字符替换)、条件编译 →汇编文件(二进制、不可执行的.s文件) → 目标文件(机器语、.o文件) → 共享库、可执行文件 用gcc命令分解其编译过程: (1)gcc -E hello.c >
2017-01-18 20:34:13
454
原创 0117编程练习
1、100以内能被5或7整除的数,每行5个数的显示出来。 程序: #include int main() { int i=1; int j=1; while(i { if(i%5==0||i%7==0) { if(j%5==0) printf("%d\n",i); else printf("%
2017-01-17 20:42:04
408
原创 程序
1、 #include #include int main(void) { char word[20]; int i; printf("Please input a word:"); scanf("%s",&word); for(i=strlen(word)-1;i>=0;i--) printf("%c",word[i]);
2017-01-08 17:01:35
220
原创 程序
1、 #include #include int main(void) { int num[8],i; for(i=0;i num[i]=pow(2,i); i=0; do printf("%d\t",num[i]); while(++i printf("\n"); return 0;
2017-01-08 16:58:29
171
原创 程序
1、 #include int main(void) { int i,j; for(i=0;i { for(j=0;j printf("%c",'F'-j); printf("\n"); } return 0; } 2、 #include int main(void) {
2017-01-08 16:56:57
167
原创 程序
1、 #include int main(void) { int i,min,max; printf("Please input the min and max:"); scanf("%d %d",&min,&max); printf("%10s%10s%10s\n","num","square","cube"); for(i=min;i
2017-01-08 16:55:07
194
原创 程序
1、 #include int main(void) { char ABC[26]; int i; for(i=0;i ABC[i]='a'+i; for(i=0;i printf("%c",ABC[i]); printf("\n"); return 0; } 2、 #inclu
2017-01-08 16:54:02
181
原创 程序
1、 #include #define B "booboo" #define X 10 int main(void) { int age; int xp; char name[20]; printf("Please enter your first name.\n"); scanf("%s",name); printf("Al
2017-01-01 11:51:21
205
原创 程序
1、 #include #define SEC 60 int main (void) { int hou,m,min; printf("Please enter time:\n"); scanf("%d",&m); hou=m/SEC; min=m-hou*SEC; printf("%d minutes is %d hours,%
2017-01-01 11:49:30
219
原创 程序
1、 #include int main(void) { char ch; int i; float f1; f1=i=ch='C'; printf("ch=%c,i=%d,f1=%2.2f\n",ch,i,f1); ch=ch+1; i=f1+2*ch; f1=2.0*ch+1; printf
2017-01-01 11:47:26
164
原创 程序(循环)
1、 #include int main(void) { int count,sum,max; count=0; sum=0; printf("Please input the max:"); scanf("%d",&max); while(count++ sum=sum+count; printf("sum
2017-01-01 11:45:41
183
原创 程序
1. #include int main(void) { char surname[20],firstname[20]; printf("Please input your firstname and surname:\n"); scanf("%s",firstname); scanf("%s",surname); printf("You a
2016-12-25 20:21:02
299
原创 程序
1. #include int main(void) { float a; printf("Please intput a float:\n"); scanf("%f",&a); printf("a.The intput ia %.1for%.1e\n",a,a); printf("b.The intput ia %+.3for%.3E\n"
2016-12-25 20:17:47
195
原创 程序
1. #include #include int main(void) { char name[20]; int width; printf("Please input your name:\n"); scanf("%s",name); printf("A:\"%s\"\n",name); printf("B:\"%20s\"\n
2016-12-25 20:16:39
174
原创 程序
1. #include #define GALLON 3.785 #define MILE 1.609 int main(void) { float mile,gallon; printf("Please input miles and gallons:"); scanf("%f%f",&mile,&gallon); printf("Mile pe
2016-12-25 20:15:28
191
原创 初学C程序
1、 #include int main (void) { int dogs; printf("How many dogs do you have?\n"); scanf("%d",&dogs); printf("So you have %d dog(s)!\n",dogs); return 0; } 2、 #incl
2016-12-18 13:01:27
244
原创 Linux 操作命令的简要介绍(12.11)
实时性:规定时间完成规定动作 嵌入式操作系统:半开源/开源操作系统 Vxworks→军方、航空 WinCE→银行、出租计费、老pose机(消费) uC/OS-→工业控制(小处理器/单片机)(5000行代码) Linux协议:(1)标准posix:开发出的软件可在Linux/UNIX使用 (2)GPL协议 (3) GNU计划:软件只能
2016-12-17 12:41:43
232
原创 传统式开发模式与嵌入式开发模式(12.10)
一、传统式开发模式 1.软件→硬件(即软件直接访问硬件) 2.缺点: (1)软件移植性差(软件需要根据硬件的改变重新编码) (2)软件开发人员必须懂硬件 二、嵌入式开发模式 1.软件→操作系统→硬件(软件通过操作系统访问硬件) 操作系统的作用:管理资源,实质上也是软件 硬件改变则要移植操作系统即修改其原码满足需要 2.优点:
2016-12-14 01:23:32
580
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人