自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

原创 建立个链表,每个结点包括: 学号、姓名、性别、年龄。 输入一个年龄,如果链表中的结点所包含的年龄等于此年龄, 则将此结点删去。(不考虑删除的是表头和表尾节点)

#include "stdio.h"#include "string.h"struct student{  int no;//学号 char name[10];//年龄 char sex[10];//性别,男:M(male),女:F(female) int age;//年龄 struct student *next;};void main(){  struct student a,b,c,*hea...

2018-05-01 21:12:28 1999

原创 求2^x的功能部分,在函数exp中完成。 2^0+(2^0+2^1)+(2^0+2^1+2^2)+…+(2^0+2^1+2^2+…+2^n)

#include "stdio.h"double exp(int m)//用递归调用求(2^n)2的n次方{ if(m==0) return 1; else return 2*exp(m-1); }void main(){ int x,i,j; double sum=0; printf("请输入 x 的值:"); scanf("%d",&x); for(i=0;i<=x;i++...

2018-05-01 14:30:20 363

原创 输入学生信息,包括姓名、成绩,按平均分划分等级,大于平均分的为A等级, 与A等级相差10 分以内的为B 等级,其它为C 等级,学生人数不可超过50人。

#include "stdio.h"#define  N 10    //N的值<=50struct student{      char name[8];//姓名    float score;//成绩    char rank;//等级} stu[N];void main(){    struct student stu[N];    int i;    float sum=0,avg;...

2018-04-30 21:25:17 1413

原创 有10个学生,每个学生的数据包括(学号,姓名、3门课程的成绩), 从键盘输入10个学生数据,要求打印出3门课程平均成绩, 以及最高分的学生数据(包括学号、姓名、3门课程成绩、平均分数)

#include "stdio.h"#define N 10struct student{  int no;//学号  char name[8];//姓名    float score[3];//成绩    float avg;//平均成绩} stu[N];void main(){ struct student stu[N]; int i,wz;//位置 double max;//最高分 for...

2018-04-30 21:22:59 8066

原创 编写一个函数, 输入n为偶数时,调用函数求1/2+1/4+...+1/n, 当输入n 为奇数时,用函数I 1/1+1/3+...+1/n(利用函数指针)

#include "stdio.h"double osh(int n)//偶数和{ double sum=0; int i;    for(i=2;i<=n;i+=2)        sum+=1.0/i;         return sum; }double jsh(int n)//奇数和{ double sum=0; int i;    for(i=1;i<=n;i+=2)   ...

2018-04-29 23:06:00 6310

原创 7.写函数原型为 int strcmp(char *s1,char *s2)的函数, 该函数实现两个字符串的比较。(不用库函数 strcmp,相等为0, 不等结果为第一个不等字符的 ASCII 之差

#include "stdio.h"#include "math.h"int strcmp(char *s1,char *s2){   while(*s1!='\0'&& *s1==*s2)   {      s1++;      s2++;   }    return *s1-*s2 ; }void main(){ char a[100],b[100]; int num; pr...

2018-04-26 20:36:53 6228

原创 编写一个求字符串的函数(参数用指针),在主函数中输入字符串,并输出其长度

/* 字符串长度要小于字符数组的长度,例如: char str[]="hello"; sizof(str)的值为10(数组长度) strlen(str)的值为5(字符串长度)*/#include "stdio.h"//#include "string.h"int fun(char *a){ int num=0;  while(*a!='\0') { num++; a++; } //num=s...

2018-04-21 17:26:49 24558 1

原创 指针实现,对传递过来的两个实型数,计算它们的和与积之后,通过参数返回

#include "stdio.h"void fun(int  *x,int  *y){ int m=*x,n=*y; int sum,product;//和,积 sum=m+n; product=m*n;  *x=sum;  *y=product;}void main(){ int a,b; printf("请输入2个数a和b:"); scanf("%d%d",&a,&b)...

2018-04-21 15:49:10 2875 1

原创 编写一个函数,交换两个数的值,要求用指针实现 。函数头部为:void fun(int *x,int *y)

#include "stdio.h"void fun(int  *x,int  *y){ int t; t=*x; *x=*y; *y=t; }void main(){ int a,b; printf("请输入a和b:"); scanf("%d%d",&a,&b); fun(&a,&b); printf("\n\ta = %d ,b = %d\n",a,

2018-04-21 15:28:59 10977 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除