c語言一道題目求教教,C語言一道題目,求教教

時間 2021-05-07 20:00:40

1樓:匿名使用者

號和四門功課的成績從鍵盤讀入。

(2) 計算每個學生的總分和平均分。

(3) 按平均成績進行排序,輸出

2樓:愛吃米糕

親,這個最基本的,你要自己練習才能慢慢寫出程式啊

3樓:小輝丿仔

這個你得自己做 ,給你提醒一下,可以陣列做

4樓:匿名使用者

#include

#include

#define null0

#define len sizeof(struct student)

struct student

;int n;

struct student *creat(void)

p2->next=null;

return(head);

}void print(struct student *head)

while(p!=null);

}struct student *del(struct student *head,long num)

p1=head;

while(num!=p1->num && p1->next!=null)

if(num==p1->num)

else printf("%ld not been found!\n",num);

return(head);

}struct student *insert(struct student *head,struct student *stud)

else

if(p0->num<=p1->num)

else

}n=n+1;

return(head);

}struct student * ordination(struct student * head)

}if(first==null)

else

if(min==head)

else

}if(first!=null)

head=first;

return(head);

}struct student * ordinationc(struct student * head)

}if(first==null)

else

if(min==head)

else

}if(first!=null)

head=first;

return(head);

}struct student *cha(struct student *head,long cha)

p1=head;

while(cha!=p1->num && p1->next!=null)

if(cha==p1->num)

else printf("%ld not been found!\n",cha);

return(head);

}struct student *chap(struct student *head)

p1=head;

while( p1->next!=null)

p1=p1->next;

}if(x) printf("沒有平均分在85分以上的學生\n");

return(head);

}struct student *chapb(struct student *head)

p1=head;

while( p1->next!=null)

p1=p1->next;

}if(x) printf("沒有不及格的學生\n");

return(head);

}void main()

printf("\ninput the inserted record:");

stu=(struct student * )malloc(len);

>num,&stu->score1,&stu->score2,&stu->score3,&stu->score4,&stu->score5,stu->name);

while(stu->num!=0)

printf("\ninput the 查詢 number:");

scanf("%ld",&cha_num);

while(cha_num!=0)

printf("下面是85分以上的:\n\n");

head=chap(head);

printf("\n");

printf("下面是不及格的:\n\n");

head=chapb(head);

printf("\n");

printf("下面是學號排序");

head=ordination(head);

print(head);

printf("\n\n");

printf("總分排序");

head=ordinationc(head);

print(head);

}這是我上學期的作業,跟你的差不多

5樓:匿名使用者

6樓:匿名使用者

#include

#include

#include

using namespace std;

const int maxn = 10000 + 10;

struct nodea[maxn];

int n, b[maxn];

void init()

}void count()

}bool cmp(int x, int y)void work()

void print()

}int main()

一道c語言題目~求教!

7樓:匿名使用者

getbits 函式未宣告

unsigned getbits(unsigned x,int p,int n);插入第三行

8樓:內蒙古新聞聯播

unsigned getbits(unsigned,int,int);

呼叫前需要宣告

9樓:匿名使用者

把getbits放到main函式前面,或者在main函式前面先申明

初學者求教一道c語言題目

10樓:

#include

#include

int main(void)

height=height*pow(0.5,n);

//小數點後多保留幾位,不然容易出現0.0,同時double型別應該是%lf

printf("distance=%.6lf\n",distance);//printf("distance=%.1f\n",distance);

printf("height=%.6lf\n",height);//printf("height=%.1f",height);

return 0;

}結果:

11樓:

#include

int main(void)

{int i,n;

double distance,height;

printf("input height:");

scanf("%lf",&height);

printf("input n:");

scanf("%d",&n);

distance = height; //第一次落地的距離for(i=1;i

input height:10

input n:2

the distance 20.000000,the times 2th.

the height 2.500000

一道c語言題目,求教,非常感謝

12樓:ziyang小子

#include

using namespace std;

class time

time()

~time()

void print_time()

int gethour()

int getminute()

int getsecond()

time(time &time)

private:

int hour, minute, second;

};int main()

請教一道C語言題目,求解一道C語言題目

呵呵 這個 容易啊 就是個 強制型別轉換的意思。首先 long 型別 佔 四個位元組。char 型別 佔 一個位元組。明白了這個 就好解決了。char p abcdefgh r long q 這兩行 標明 p是指向字元的指標 並且 指向abcdefgh這個字串 實際是指向a r 為指向字元的指標。q...

求解一道C語言題,求解一道C語言題目

不考慮效能優化,只考慮功能可以這麼寫 include stdio.h include string.h define max str len 128int main char str2 max str len scanf s s str1,str2 for i 0 i strlen str1 i e...

一道簡單的c語言題目,一道簡單的C語言題目

s 2 是一個指標陣列,指向兩個字串 s 0 s 1 while s 1 0 迴圈,條件為 s 1 0 字串的最後一個值是 0 這裡遍歷s 1 字串,一共會遍歷4次。 寒鐵礦 你定義了一個指標陣列,s 0 指向的是第一個 字串的起始地址,s 1 指向的是第二個 字串的起始地址。while s 1 0...