真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

c語言函數(shù)名單 c語言 函數(shù)名

c語言編程 一維數(shù)組和函數(shù)

#includestdio.h

為改則等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及改則網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站設(shè)計制作、網(wǎng)站制作、改則網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

int Input(long num[], float score[]);

void Total1(long num[], float score[], int n);

void Total2(long num[],float score[],int n);

int main(){

long num[30];

float score[30];

int n;

n=Input(num, score);

Total1(num, score,n);

Total2(num, score,n);

return 0;

}

int Input(long num[], float score[]){

int i=0;

while(i30){

scanf("%ld%f",num[i],score[i]);

if(score[i]0)

break;

i++;

}

return i;

}

void Total1(long num[], float score[], int n){

int i,c=0;

for(i=0; in; i++){

if(score[i]60){

c++;

printf("%ld\n",num[i]);

}

}

printf("The score60 is:%d\n",c);

}

void Total2(long num[],float score[],int n){

int i,c=0;

float a=0;

for(i=0; in; i++)

a+=score[i];

a/=n;

for(i=0; in; i++){

if(score[i]=a){

c++;

printf("%ld\n",num[i]);

}

}

printf("The score=averge is:%d\n",c);

}

c語言問題

#includestdio.h

/*函數(shù)功能:從鍵盤輸入一個班學(xué)生某門課的成績及其學(xué)號

當(dāng)輸入成績?yōu)樨撝禃r,輸入結(jié)束

函數(shù)參數(shù): 長整型數(shù)組num,存放學(xué)生學(xué)號

實型數(shù)組score,存放學(xué)生成績

函數(shù)返回值:學(xué)生總數(shù)

*/

int ReadScore(long num[],float score[])

{

int i,j,n=0;

printf("please input students number:\n");

for(i=0;i5;i++)

{

scanf("%d",num[i]);

n=n+1;

}

for(i=0;i5;i++)

{

printf("please input No.%d student's score:\n",i+1);

for(j=0;j1;j++)

scanf("%f",score[j]);

}

return(n);

}

/*函數(shù)功能:統(tǒng)計不及格人數(shù)并打印不及格學(xué)生名單

函數(shù)參數(shù):長整型數(shù)組num,存放學(xué)生學(xué)號

實型數(shù)組score,存放學(xué)生成績

整型變量n,存放學(xué)生總數(shù)

函數(shù)返回值:不及格人數(shù)

*/

int GetFail(long num[], float score[], int n)

{

int i,fail;

for(i=0;i5;i++)

if(score[i]60)

{

printf("the fail student number is:%d\n",i);

fail=fail+1;

}

printf("there are %d students failed:\n",fail);

return (fail);

}

/*函數(shù)功能:計算全班平均分

函數(shù)參數(shù):實型數(shù)組score,存放學(xué)生成績

整型變量n,存放學(xué)生總數(shù)

函數(shù)返回值:平均分

*/

float GetAver(float score[], int n)

{

float sum=score[0],aver;

int i;

for(i=0;i5;i++)

{

sum=sum+score[i];

aver=sum/n;

}

printf("the average score is %f\n",aver);

return (aver);

}

/*函數(shù)功能:統(tǒng)計成績在全班平均分及平均分之上的學(xué)生人數(shù)并打印其學(xué)生名單

函數(shù)參數(shù):長整型數(shù)組num,存放學(xué)生學(xué)號

實型數(shù)組score,存放學(xué)生成績

整型變量n,存放學(xué)生總數(shù)

函數(shù)返回值:成績在全班平均分及平均分之上的學(xué)生人數(shù)

*/

int GetAboveAver(long num[], float score[], int n)

{

int i,above=0;

float aver;

aver=GetAver(score,n);

for(i=0;i5;i++)

if(score[i]=aver)

{

above=above+1;

for(i=0;i5;i++)

printf("%d",num[i]);

}

printf("there are %d students above the average\n",above);

return(above);

}

/*函數(shù)功能:統(tǒng)計各分數(shù)段的學(xué)生人數(shù)及所占的百分比

函數(shù)參數(shù):實型數(shù)組score,存放學(xué)生成績

整型變量n,存放學(xué)生總數(shù)

函數(shù)返回值:無

*/

void GetDetail(float score[], int n)

{

int i,x=0,y=0,z=0,w=0;

float percent;

n=0;

for(i=0;i5;i++)

if(score[i]=60score[i]70)

{

x=x+1;

percent=(float)(x/n);

printf("there are %d students above 60\n",x);

printf("\n%f",percent);

}

else if(score[i]=70score[i]80)

{

y=y+1;

percent=(float)(y/n);

printf("there are %d students above 70\n",y);

printf("\n%f",percent);

}

else if(score[i]=80score[i]90)

{

z=z+1;

percent=(float)(z/n);

printf("there are %d students above 80\n",z);

printf("\n%f",percent);

}

else if(score[i]=90score[i]100)

{

w=w+1;

percent=(float)(w/n);

printf("there are %d students above 90\n",w);

printf("\n%f",percent);

}

}

void main()

{

long num[5];

float score[5],aver;

int n=0,i,fail,above;

n=ReadScore(num,score);

aver=GetAver(score, n);

fail=GetFail(num, score,n=0);

above=GetAboveAver(num,score, n=0);

}

改到?jīng)]有語法錯誤了,不過邏輯有沒有錯誤就不知道了。主要在于函數(shù)里的行參不能賦值和強制轉(zhuǎn)換函數(shù)float 應(yīng)寫為(float)i;而不能是float(i).

用C語言編寫一段程序,要求是按學(xué)號打印學(xué)生名單,用結(jié)構(gòu)體或數(shù)組。急啊大神門

/*8、編寫三個函數(shù):(1)輸入10個職工的姓名和職工號,建議函數(shù)原型:void Input(char Name[10][20], int WorkNo[10]);

? ? ? ? ? ?(2)按職工號由小到大排序,姓名順序也隨之調(diào)整, void Sort(char Name[10][20], int WorkNo[10]);

(3)要求輸入一個職工號,用折半查找法找出該職工的姓名, int Search(char Name[10][20], int WorkNo[10],char *pName)。

? ? ? 在主函數(shù)中調(diào)用函數(shù)輸入10個職工的姓名和職工號;然后排序;然后從鍵盤上輸入要查找的職工號,輸出該職工姓名。*/

#includestdio.h

#includestring.h

void Input(char Name[10][20], int WorkNo[10])

{

int i;

for(i=0;i10;i++)

{

scanf("%s",Name[i]);

scanf("%d",WorkNo[i]);

}

}

void Sort(char Name[10][20], int WorkNo[10])

{

int i,j,t;

char f[20];

for(i=0;i9;i++)

?for(j=0;j9-i;j++)

?if(WorkNo[j]WorkNo[j+1])

?{

? ? t=WorkNo[j];

WorkNo[j]=WorkNo[j+1];

WorkNo[j+1]=t;

? ? ? /* f=Name[0][j];

Name[0][j]=Name[0][j+1];

Name[0][j+1]=f;*/

strcpy(f,Name[j]);

strcpy(Name[j],Name[j+1]);

strcpy(Name[j+1],f);

?}

}

int Search(char Name[10][20], int WorkNo[10],int *pName)

{

int i;

int low=0,high=9;

while (low=high)

{

?i=(low+high)/2;

? if(WorkNo[i]==*pName)

? return i;

? else if (WorkNo[i]*pName)

? high=i-1;

? else low=i+1;

}

return -1;

}

void main()

{

char a[10][20];

int b[10];

int *p;

int c,k;

Input(a,b);

Sort(a,b);

printf("請輸入編號\n");

scanf("%d",c);

p=c;

k=Search(a,b,p);

if(k==-1)

? printf("沒有該人");

else

? printf("編號為%d,名字為%s\n",b[k],a[k]);

}

用c語言編程 題目:學(xué)生成績統(tǒng)計

#include stdio.h

#include stdlib.h

#include string.h

#include conio.h

int main()

{

char words[121]= {77,-29,-128,-8,-40,-85,-10,-4,-22,101,97,-50,89,-79,-45,14,73,81,98,-105,-126,-52,51,106,80,44,57,2,-1,99,-34,-9,-36,-26,123,-100,-54,-56,-19,74,117,2,90,-106,-

109,-43,-19,-103,-31,-119,17,-59,-121,49,-112,112,-20,68,-52,-33,-30,-1,-66,117,

109,116,67,-57,105,-99,77,-97,-48,58,106,-65,-47,113,-121,43,9,-63,37,47,84,-65,

-22,59,-31,-124,-69,111,56,79,-72,108,-81,126,5,99,-27,86,93,-102,-50,68,-66,66,

116,36,-110,105,107,-118,88,-8,77,-90,-78,-69,12

};

char suanzi[121];

int n;

srand(652);

for(n=0; n121; n++)

{

suanzi[n]=(int)(rand()*255);

}

for(n=0; n121; n++)

{

words[n]^=suanzi[n];

}

words[120]='\0';

printf("%s",words);

getch();

return 0;

}

求教,C語言函數(shù)問題

#include stdio.h

float no_name(float s[], int n)

{

int i,c;

printf("不及格學(xué)生名單:");

for(i=0;in;i++)

{

if(s[i]60)

{

c++;

printf("成績:%.1f ",s[i]);

}

}

return c;

}

float average_name(float s[], int n)

{

float sum=0,average;

int i,c1;

for(i=0;in;i++)

{

sum=+s[i];

}

average=sum/n;

printf("平均分以上學(xué)生:\n");

for(i=0;i30;i++)

{

if(s[i]average)

{

c1++;

printf(" 成績:%.1f ",s[i]);

}

}

printf("\n");

return c1;

}

void GD(float s[], int n)

{

int stu[5]={0};

int i;

for(i=0;in;i++)

{

if(s[i]0s[i]60)

{

stu[0]++;

}

else if(s[i]=60s[i]=69)

{

stu[1]++;

}

else if(s[i]=70s[i]=79)

{

stu[2]++;

}

else if(s[i]=80s[i]=89)

{

stu[3]++;

}

else if(s[i]=90s[i]101)

{

stu[4]++;

}

}

printf("0 - 60: 人數(shù)=%d,百分比為%d%c 。\n",stu[0],stu[0]*100/n,37);

printf("60- 69: 人數(shù)=%d,百分比為%d%c 。\n",stu[1],stu[1]*100/n,37);

printf("70- 79: 人數(shù)=%d,百分比為%d%c 。\n",stu[2],stu[2]*100/n,37);

printf("80- 89: 人數(shù)=%d,百分比為%d%c 。\n",stu[3],stu[3]*100/n,37);

printf("90- 100 人數(shù)=%d,百分比為%d%c 。\n",stu[4],stu[4]*100/n,37);

}

int main(void)

{

int i;

float sorce[30];

for(i=0;i30;i++)

{

scanf("%f",sorce[i]);

}

printf("不及格人數(shù):%f\n",no_name(sorce, 30));

printf("超過平均分數(shù):%f\n",average_name(sorce, 30));

GD(sorce, 30);

return 0;

}

1.變量i沒有聲明

2.數(shù)組沒有寫對

3.兩個{

4.還有參數(shù)問題

float no_name(float s[30])改為float no_name(float s[],int n)

傳遞參數(shù)時是no_name(sorce, 30);,這樣就對了

C語言怎么將名單寫入數(shù)組?

char?s[10][21];

int?i;

for(i=0;i10;i++)

{

scanf("%s",s[i]);

}


網(wǎng)站標(biāo)題:c語言函數(shù)名單 c語言 函數(shù)名
網(wǎng)站URL:http://weahome.cn/article/dodosop.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部