2020年7月2日

(C语言)买东西找零钱

摘要: #include <stdio.h>#include <string.h>#define N 1000void main(){ int x, y,sum=0; printf("请输入小明的钱和购买物品的钱:"); scanf("%d %d", &x, &y); x = x - y; sum += x 阅读全文

posted @ 2020-07-02 23:19 白胡 阅读(779) 评论(0) 推荐(0) 编辑

今日错误(C语言)(定义二维数组储存)

摘要: #include <stdio.h>#include <string.h>#define P 1000int main(){ int i, j,K,N; char s[P][P], temp[P]; printf("请输入N和K的值:"); scanf("%d %d", &N, &K); for ( 阅读全文

posted @ 2020-07-02 10:43 白胡 阅读(158) 评论(0) 推荐(0) 编辑

2020年6月21日

使用指针与数组

摘要: #include <stdio.h>#define N 10void Maxmin(int *ps)//查出数组中最大最小值{ int i,max=ps[0],min=ps[0]; for(i=1;i<N;i++) { max=(max>ps[i]?max:ps[i]); min=(min<ps[i 阅读全文

posted @ 2020-06-21 19:28 白胡 阅读(139) 评论(0) 推荐(0) 编辑

2020年6月20日

(C语言)学生成绩管理程序

摘要: #include <stdio.h>typedef struct Student{ char name[10]; float math;//高数 float english;//英语 float physics;//大学物理 float clanguage;//C语言 float maogai;// 阅读全文

posted @ 2020-06-20 17:06 白胡 阅读(625) 评论(0) 推荐(0) 编辑

2020年6月16日

使用指针交换字符

摘要: #include"stdio.h"#define N 100#include"string.h"int fun(char a[N]){ int k,i=0; char *q=a,*p,t; k=strlen(a); p=a+k-1; while(i<k/2) { t=*q; *q=*p; *p=t; 阅读全文

posted @ 2020-06-16 08:53 白胡 阅读(507) 评论(0) 推荐(0) 编辑

使用指针交换数字

摘要: #include <stdio.h> #define N 100 #include"string.h"void main(){ int a[9]={1,2,3,4,5,6,7,8,9}; int *p=a,t,i; int *q=a+9-1; while(q>p) { t=*p; *p=*q; *q 阅读全文

posted @ 2020-06-16 08:41 白胡 阅读(282) 评论(0) 推荐(0) 编辑

2020年6月15日

C语言中如何随机选数

摘要: #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,n; char b = 'y'; srand((unsigned int)time(NULL));//以时间作为种子。 a=(rand()%1000 阅读全文

posted @ 2020-06-15 20:25 白胡 阅读(750) 评论(0) 推荐(0) 编辑

导航