上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: 题目:学习使用external的用法。 程序分析:无。 实例: 1 #include <stdio.h> 2 int a,b,c; 3 void add() 4 { 5 int a; 6 a=3; 7 c=a+b; 8 } 9 int main() 10 { 11 a=b=4; 12 add(); 阅读全文
posted @ 2020-06-12 21:14 C语言自学网 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 题目:学习使用static的另一用法。 程序分析:无。 实例: 1 #include <stdio.h> 2 int main() 3 { 4 int i,num; 5 num=2; 6 for(i=0;i<3;i++) 7 { 8 printf("num 变量为 %d \n",num); 9 nu 阅读全文
posted @ 2020-06-12 21:12 C语言自学网 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 题目:学习使用auto定义变量的用法。 程序分析:无。 实例: 1 #include <stdio.h> 2 int main() 3 { 4 int i,num; 5 num=2; 6 for(i=0;i<3;i++) 7 { 8 printf("num 变量为 %d \n",num); 9 nu 阅读全文
posted @ 2020-06-12 21:11 C语言自学网 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 题目:学习static定义静态变量的用法。 程序分析:无。 实例: 1 #include<stdio.h> 2 int main() 3 { 4 void fun(); 5 for(int i=0;i<3;i++) 6 fun(); 7 return 0; 8 } 9 void fun() 10 { 阅读全文
posted @ 2020-06-07 22:32 C语言自学网 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 谈及C/C++,功能强大、应用广泛,一旦掌握了后,若是再自学其他语言就显得轻而易举了。那为什么学C/C++的人少呢?很多人认为C/C++虽然博大精深,但也难学。其实就本人认为C/C++并非是“difficult(困难)”的,只要你能理清思路,掌握它的精髓,配合一套教材。那么学C/C++是一件非常容易 阅读全文
posted @ 2020-06-06 15:39 C语言自学网 阅读(1667) 评论(0) 推荐(0) 编辑
摘要: 题目:将一个数组逆序输出。 程序分析:用第一个与最后一个交换。 实例: 1 #include<stdio.h> 2 #define N 10 3 int main() 4 { 5 int a[N]={0,1,2,3,4,5,6,7,8,9}; 6 int i,t; 7 printf("原始数组是:\ 阅读全文
posted @ 2020-06-06 14:48 C语言自学网 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。 程序分析:首先判断此数是否大于最后一个数,然后再考虑插入中间的数的情况,插入后此元素之后的数,依次后移一个位置。 实例: 1 #include<stdio.h> 2 int main() 3 { 4 int a[11]={ 阅读全文
posted @ 2020-06-06 14:46 C语言自学网 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 题目:求一个3*3矩阵对角线元素之和 程序分析:利用双重for循环控制输入二维数组,再将a[i][i]累加后输出。 实例: 1 #include<stdio.h> 2 #define N 3 3 int main() 4 { 5 int i,j,a[N][N],sum=0; 6 printf("请输 阅读全文
posted @ 2020-06-06 14:44 C语言自学网 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目:对10个数进行排序。 程序分析:可以利用选择法,即从后9个比较过程中,选择一个最小的与第一个元素交换, 下次类推,即用第二个元素与后8个进行比较,并进行交换。 实例: 1 #include<stdio.h> 2 #define N 10 3 int main() 4 { 5 int i,j,a 阅读全文
posted @ 2020-06-06 14:21 C语言自学网 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 题目:求100之内的素数。 程序分析:质数(prime number)又称素数,有无限个。一个大于1的自然数,除了1和它本身外,不能被其他自然数整除。 实例: 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int i,j,k,n= 阅读全文
posted @ 2020-06-06 14:19 C语言自学网 阅读(651) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页