- 博客(22)
- 收藏
- 关注
原创 姓名排序-S4
#include<stdio.h> #include<string.h> main() { int i,j,k; char name[10][80],temp[80]; for(i=0; i<10; i++) gets(name[i]); for(i=0; i<9; i++) { k = i...
2018-06-03 11:27:42
205
原创 学生成绩统计 S4
#include<stdio.h> main() { int i,j; float score[10][5],a[10],b[10]; for(i=0; i<10; i++) for(j=0; j<5; j++) scanf("%f",&score[i][j]); for(i=0; i&l...
2018-06-03 11:21:55
161
原创 4-字符个数统计
#include<stdio.h> main() { int i,a=0,b=0,c=0,d=0; char str[80]; gets(str); for(i=0;str[i]!='\0';i++) { if(str[i]>='A' && str[i]<='Z') a++; ...
2018-06-03 11:18:12
190
原创 简单加密程序 实习4
#include<stdio.h> main() { int i; char str[200]; gets(str); for(i=0;str[i]!='\0';i++) {if((str[i]>='A'&&str[i]<='X')||(str[i]>='a'&&str[i]<='x')) str[i] = ...
2018-06-03 11:15:48
238
原创 数组编程问题总结
1.键入字符串,统计字符数#include<stdio.h> main() { char str[80]; int i,cnt1=0,cnt2=0,cnt3=0,cnt4=0; gets(str); for(i=0; str[i]!='\0'; i++) { if(str[i]>='A'&&str[i]<...
2018-06-03 03:07:04
307
原创 将给定的字符串复制到另一字符串
将给定的字符串复制到另一字符串#include<stdio.h> main() { char s1[80] , s2[80]; int i; gets(s1); for(i=0;s1[i]!='\0';i++) s2[i]=s1[i]; s2[i]='\0'; puts(s2); }
2018-06-02 14:11:32
5243
原创 实习三-猴子吃桃问题
#include<stdio.h> main() { int x=1,n; scanf("%d",&n); while (n>1) { x=2*(x+1); n--; } printf("%d\n",x); }
2018-06-02 12:45:53
182
原创 实习三-求最大公约数和最小公倍数
#include<stdio.h> main() { int m,n,r,a,b; scanf("%d%d",&m,&n); a=m; b=n; do{ r=m%n; m=n; n=r; } while(r!=0); printf("%d\n%d\n",m,a...
2018-06-02 12:45:45
216
原创 实习三-sin(x)
#include <stdio.h> #include <math.h> main() { double sum,t,x; int i; scanf("%lf",&x); sum=x; i=1; t=x; while(fabs(t)>=1e-4) { t=-x*x*t/((2*i+...
2018-06-02 12:45:37
169
原创 实习三-爱因斯坦阶梯问题
#include<stdio.h> main() { int x=7; while((x%2!=1)||(x%3!=2)||(x%5!=4)||(x%6!=5)||(x%7!=0)) { x+=7; } printf("%d\n",x); }
2018-06-02 12:45:30
395
原创 3-数据统计
#include<stdio.h> main() { int i,j=0,m,n,a=0,b=0,k=0; scanf("%d\n",&n); for(i=0;i<n;i++) { scanf("%d",&m); if(m%2!=0) { a=a+m; ...
2018-06-02 12:45:22
159
原创 3-*图形输出
#include<stdio.h> main() { char a; int i,j,b; scanf("%c%d",&a,&b); for(i=1;i<=b;i++) { for(j=1;j<=b-i;j++) putchar(' '); for(j=1;j...
2018-06-02 12:45:14
231
原创 4-杨辉三角
#include<stdio.h> main() { int i,j,k,a[30][30]={0}; scanf("%d",&k); for(i=0;i<10;i++) { a[i][0]=1; a[i][i]=1; } for(i=2;i<k;i++) for(j=1;j<i;j++) a[i][j]=a[i-1][j...
2018-06-02 12:45:04
135
原创 4-字符串连接
#include <stdio.h> #include <string.h> int main() { char a[80],b[80]; gets(a); gets(b); int i,la=strlen(a),lb=strlen(b); for(i=0;i<lb;i++) a[la+i]=b[i]; ...
2018-06-02 12:44:57
219
原创 4-数据顺序调整
#include<stdio.h> #include<string.h> main() { int i,a[10],temp; int max=0,min=0; for(i=0; i<10; i++) scanf("%d",&a[i]); for(i=0; i<10; i++) { ...
2018-06-02 12:44:46
236
原创 文件 知识点整理
文件文件类型指针 : FILE *标识符 eg. FILE*fp打开文件:fopen()用指定的文件使用模式打开指定文件,并返回一个文件指针。FILE *fp; fp=fopen(文件名,文件使用模式);文件名为要打开文件的完整描述,即为“文件地址+文件名”,为字符串,地址用/或\\表示文件使用模式:文件读写:读函数写函数fscanf( )fprintf( )fgetc( )fputc( )...
2018-06-02 12:42:44
502
原创 4-矩阵对角线元素求和
#include<stdio.h> void main() { int x[5][5]; int i ,j; int sum1=0,sum2=0; for(i=0;i<5;i++) for(j=0;j<5;j++) scanf("%d",&x[i][j]); for(i=0;i<5;i++) for(j=0;j<5;j++) { if(i ==...
2018-06-02 10:31:09
4341
原创 函数复习
函数知识点函数的概念:功能独立的一个程序段执行具体的、明确定义的任务程序功能可以复用,即多次执行函数定义:类型标识符 函数名(形式参数列表) {函数体[return 函数运算结果]}eg.定义一个求阶乘的函数int jiecheng(int n) { int i; int result=1; for(i=n;i>0;i--) result*=i; return result;...
2018-06-02 10:28:40
175
原创 指针C5知识点总结
指针知识点1.指针的概念指针是地址// p=&a[0][0];/p=*a;/p=&a; 运算符:①&取地址运算符 p=&a:把a的地址赋给指针变量p int a,*p; p=&a;简化为:int a,*p=&a;//定义指针变量的同时为指针变量赋初值叫做指针变量的初始化;若无初始化或赋值,指针变量的值是一个随机数,随机指向②*指针运算符(...
2018-06-02 01:55:34
239
原创 C5-三-5
判断回文指针:#include<stdio.h>//判断字符串回文 #include<string.h> main() { char *p; char str[100]; int i,n,flag=1; gets(str); p=str;//p指向字符数组 n=strlen(str); for(i=0;i<n/...
2018-06-01 22:55:33
133
原创 C5-三-4
#include<stdio.h> main() { char *p; char str[100]; int cnt1,cnt2,cnt3,cnt4; cnt1=cnt2=cnt3=cnt4=0; gets(str); p=str;//p指向字符数组 while(*p!='\0') { if(*p=='a...
2018-06-01 21:47:11
109
原创 C5-三-3
指针转置输入:1 2 3 45 6 7 84 5 6 75 6 7 8输出:1 5 4 52 6 5 63 7 6 74 8 7 8指针:#include<stdio.h> main() { int *p,a[4][4]; int i,j,t; for(i=0; i<4; i++) for(j=0; j<4; j++) ...
2018-06-01 21:19:03
147
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人