- 博客(16)
- 收藏
- 关注
原创 C语言 冒泡法数组排序
方案一: # include # include # include int main (void) { int i,n,j,temp; printf("Enter a number n : "); scanf("%i",&n); int a[n]; srand((unsigned)time(NULL)); for (i=0;i a[i]=rand()
2014-11-20 14:27:08
926
原创 C语言 堆栈的压栈与退栈
测试: [root@localhost Gcc]# ./a.out Enter a number n : 10 51 89 62 79 40 61 38 18 17 50 50 17 18 38 61 40 79 62 89 51 [root@localhost Gcc]# ./a.out Enter a number n : 20
2014-11-19 16:37:06
1230
原创 C语言 堆栈的建立
# include # include # include struct chain { int data; struct chain *next; }; struct chain *push(int n, int *data1) { struct chain *top,*s; top=NULL;
2014-11-19 15:40:23
1268
原创 C 语言 将数组传到单链表中
# include # include # include struct chain { int data; struct chain *next; }; struct chain *create(int n,int *a) { int i; struct chain *head ,*rear,*p;
2014-11-19 15:37:53
3647
原创 C语言 建立栈报错 error: dereferencing pointer to incomplete type
# include # include # include struct stacknode { int data; struct stacknode *next; }; struct stacknode *push(int n ) { struct stactnode *top,*s; top=NULL;
2014-11-19 14:41:18
1185
原创 C语言--单链表之调用输出函数
# include # include # include typedef struct chain { int data; struct chain *next; } list; list *create() { int i ,n ; list *head , *tail ,*p; he
2014-11-17 17:27:49
2301
原创 C语言--随机生成一个数组并逆置输出
测试: [root@security Gcc]# ./a.out Enter a number n : 10 **************************************** 79 77 38 80 25 20 37 22 46 97 **************************************** 97 46 22
2014-11-15 12:03:09
3891
原创 C语言-是用单链表求整数的位数以及其和
# include # include struct chain { int value; struct chain *next; }; struct chain *create () { struct chain *head,*tail,*p; int n,i,x; head = tai
2014-11-15 11:05:39
379
原创 C语言-使用数组求数字的位数已经其和
# include # define N 20 int convert (int n) { if (n/10==0) return n; else convert(n%10); } int main (void) { int n,i=0,j=0,sum=0;
2014-11-14 20:52:21
754
原创 C语言-打印三角型
# include int main (void) { int i,j,k,n; printf("Enter a number n : "); scanf("%i",&n); for (i=0;i { for (j=0;j
2014-11-14 16:06:00
556
原创 C语言建立单链表出错误及其分析
# include # include # include struct chain { int value1; int value2; struct chain *next; }; struct chain *create() { struct chain *head,*tail,*p;
2014-11-13 17:24:10
820
原创 C语言 二维数组转置之函数调用2
# include # include # include # define N 4 int main (void) { int a[N][N]; CreateArray(a); PrintArray(a); Convert(a); printf
2014-11-12 14:27:09
1270
原创 C语言 二维数组转置之函数调用
[root@localhost Gcc]# gcc 1-1.c 1-1.c: In function ‘convert’: 1-1.c:49: error: subscripted value is neither array nor pointer 1-1.c:50: error: subscripted value is neither array nor pointer 1-1.c
2014-11-12 12:00:42
7551
原创 C语言二维数组转置
# include # include # define N 4 int main (void) { int i,j,temp; int a[N][N]; srand((unsigned)time(NULL)); for (i=0;i {
2014-11-12 11:29:56
2714
原创 C语言中的例子--伪随机数
# include # include # include int main (void) { srand((unsigned)time(NULL)); int i; for (i=0;i printf("%4i",rand()0+1); printf("\n");
2014-11-12 11:16:08
371
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅