當前位置:首頁 » 編程語言 » C語言程序設計課程的問卷
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

C語言程序設計課程的問卷

發布時間: 2022-06-18 09:11:48

⑴ C語言設計問卷調查系統 要求用單鏈表做

屌絲 第三題 你就別做了 直接第四題吧~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <stdlib.h>
struct player
{
char name[30];
int num;
char team[30];
char nationality[30];
float score[8];
float final_socre;
struct player*next;
};

void create(player * head)
{
int i=0;
struct player *player1=(struct player*)malloc(sizeof(struct player));
while(head!=NULL)
{head=head->next;
}

printf("請輸入姓名\n");
scanf("%s",player1->name);
printf("請輸入編號\n");
scanf("%d",&player1->num);
printf("請輸入代表隊\n");
scanf("%s",player1->team);
printf("請輸入國籍\n");
scanf("%s",player1->nationality);
printf("請輸入7位評委對其評分\n");

for(i=0;i<7;i++)
scanf("%f",&(player1->score[i]));
player1->final_socre=0;
head=player1;
player1->next=NULL;
}

float max_score(float score[])//
{
int i=0;
float max=score[0];
for(i=1;i<7;i++)
if(score[i]>max)
max=score[i];
return max;
}

float min_score(float score[])
{
int i=0;
float min=score[0];
for(i=1;i<7;i++)
if(score[i]<min)
min=score[i];
return min;
}

t n,player * head)//運動員分數的處理:刪去最大值,最小值,求平均數
{int i=0;
float sum=0;
while(head!=NULL)
{
i++;
if(i==n)
{
for(i=0;i<7;i++)
sum=sum+head->score[i];
sum=sum-min_score(head->score)-max_score(head->score);
head->final_socre=sum/5.0;
break;
}
}
head=head->next;
}

void show_info(int n,player * head)
{
int i=0;
float sum=0;
while(head!=NULL)
{
i++;
if(i==n)
{
printf("姓名:%s\n",head->name);
printf("編號:%d\n",head->num);
printf("代表隊:%s\n",head->team);
printf("國籍:%s\n",head->nationality);
printf("最後得分:%f\n",head->final_socre);
break;
}
}
head=head->next;
}

void main()
{
int i;
struct player *head=(struct player*)malloc(sizeof(struct player));
head->next=NULL;
printf("請為參賽的10名選手錄入信息:\n");
for(i=0;i<10;i++)
create(head);
scores(1,head);
scores(10,head);
show_info(1,head);
show_info(10,head);
}

⑵ C語言程序設計課程講什麼內容

C語言程序設計課程是入門級的程序設計課程,針對沒有或很少具有編程經驗的在職人員。課程通過學習C語言編程的基礎語法,對程序設計有一個基本的認識,為後續計算機專業課程以及面向對象程序設計課程的學習打下基礎。 課程主要內容:C語言程序基本結構及相關概念、變數、函數、語句、if條件語句、switch條件語句、for循環語句、while循環語句、數組、指針、字元串、結構體。

⑶ 《C語言程序設計》課程設計

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>

#define BUFFERSIZE 1024
#define MAXACCOUNT 1000
typedef struct BankAccount
{
int account;
int key;
char name[32];
float balance;
}BANKACCOUNT;

BANKACCOUNT accountCollection[MAXACCOUNT];
int curAccount = 0;

void InsertAccount(FILE *fp)
{
BANKACCOUNT newaccount;
printf("please input the account information\n");
printf(">>account num:");
scanf("%d",&(newaccount.account));
printf(">>key:");
scanf("%d",&(newaccount.key));
printf(">>name:");
scanf("%s",newaccount.name);
printf(">>balance:");
scanf("%f",&(newaccount.balance));
fseek(fp,0L,SEEK_END);
fprintf(fp,"%d %d %s %.2f\n",newaccount.account,newaccount.key,newaccount.name,newaccount.balance);
}
void GetAccount(FILE *fp)
{
int accountnum;
int key;
char name[32];
float balance;
int i =0,j;
char buffer[BUFFERSIZE];
int len;
curAccount = 0;
fseek(fp,0,SEEK_SET);
while(!feof(fp)) /* 因為feof()最後會讀2遍,所以最後curAccount多加了1 */
{
fscanf(fp,"%d %d %s %f",&accountnum,&key,name,&balance);
accountCollection[curAccount].account = accountnum;
accountCollection[curAccount].key = key;
strcpy(accountCollection[curAccount].name ,name);
accountCollection[curAccount].balance = balance;
curAccount++;
}
}
void ListAccount(FILE *fp)
{
int i =0;
printf("There is %d accounts at all:\n",curAccount-1);/* curAccount減去多加的1 */
for(i = 0;i< curAccount-1;i++)
{
printf("ACCOUNT[%d]:\n",i+1);
printf("account:%d\n",accountCollection[i].account);
printf("name:%s\n",accountCollection[i].name);
printf("balance:%.2f\n",accountCollection[i].balance);
}
}
int SearchAccount(FILE *fp,int accountnum)
{
int i =0;
for(i = 0;i< curAccount-1;i++)
{
if(accountCollection[i].account == accountnum)
{
printf("ACCOUNT[%d]:\n",i+1);
printf("account:%d\n",accountCollection[i].account);
printf("name:%s\n",accountCollection[i].name);
printf("balance:%.2f\n",accountCollection[i].balance);
return 1;
}
}
return 0;
}
void DelAccount(FILE *fp,int accountnum)
{
int i;
if(SearchAccount(fp,accountnum)==0)
printf("Can't find the account\n");
else
{
for(i = 0;i<curAccount-1;i++)
{
if(accountCollection[i].account != accountnum)
fprintf(fp,"%d %d %s %.2f\n",accountCollection[i].account,accountCollection[i].key,accountCollection[i].name,accountCollection[i].balance);
}
printf("delete successfully!\n");
}
}

int main()
{
FILE *fp;
int accountnum;
int i;
do{
system("cls"); //清屏
puts("********************************************");
puts("* You can choose : *");
puts("* 1 : Insert a new Account *");
puts("* 2 : List all Accounts *");
puts("* 3 : Find a Account *");
puts("* 4 : Delete a Account *");
puts("* 5 : quit *");
puts("********************************************");
printf("Please input your choice:");
scanf("%d",&i);
system("cls"); //清屏
switch(i)
{
case 1:
if(!(fp = fopen("account.txt","a+")))
{
printf("can't open the file account.txt\n");
exit(0);
}
InsertAccount( fp);

printf("press any key to continue.....\n");
getch();
fclose(fp);
break;
case 2:
if(!(fp = fopen("account.txt","r")))
{
printf("can't open the file account.txt\n");
exit(0);
}
GetAccount(fp);
ListAccount(fp);

fclose(fp);
printf("press any key to continue.....\n");
getch();
break;
case 3:
printf("please input the account num:\n");
scanf("%d",&accountnum);
if(!(fp = fopen("account.txt","r")))
{
printf("can't open the file account.txt\n");
exit(0);
}
GetAccount(fp);
if(!SearchAccount(fp,accountnum))
printf("There is not the account:%d\n",accountnum);

fclose(fp);
printf("press any key to continue.....\n");
getch();
break;
case 4:
printf("please input the account num:\n");
scanf("%d",&accountnum);
if(!(fp = fopen("account.txt","r")))
{
printf("can't open the file account.txt\n");
exit(0);
}
GetAccount(fp);
fclose(fp);
if(!(fp = fopen("account.txt","w+")))
{
printf("can't open the file account.txt\n");
exit(0);
}
DelAccount(fp,accountnum);
fclose(fp);
printf("press any key to continue.....\n");
getch();
break;
default:
break;
}
}while(i != 5);
return 0;
}
賬戶數據文件名已經設定為account.txt,這個文件要和上面這個程序放在同一個文件夾下面,不然就得用絕對路徑(比如"d:\\book\\account.txt"),account內容可以用記事本打開自己改動,然後運行程序後就可以在程序中添加或刪除

⑷ C語言 問卷調查的數據統計

C語言 問卷調查的數據統計 可以提供

⑸ 《C語言程序設計》課程作業二答案

第四題上面那些是作什麼的?
第四題:1. d=1 k++ k<=n
2. x>=0 x<amin
3. float y=1 y*=i float s=1
4. (8) r (9)r=m%n (10)gcd=n
第五題:
#include "stdio.h"
#define N 8
void main()
{
int i,j,a[N][N];
for(i=0;i<N;i++)
a[i][0]=a[i][i]=1;
for(i=2;i<N;i++)
{
for(j=1;j<i;j++)
a[i][j]=a[i-1][j]+a[i-1][j-1];
}
for(i=0;i<N;i++)
{
for(j=0;j<=i;j++)
printf("%3d",a[i][j]);
printf("\n");
}
}
2.
#include "stdio.h"
#define N 100
void main()
{
int i,sum=0;
for(i=2;i<=N;i+=2)
sum+=i;
printf("sum=%d\n",sum);
}

⑹ 想用C語言設計一個統計調查問卷的程序。想法是這樣的:把所有調查對象的答案存入一個二維數組中,列為題

#include<stdio.h>
void main(){
int x[10][6];//存選項,10代表10個題,6代表6個人的答案
int y[10][4];//存統計的數量,10代表10個題,4代表ABCD這四個選項

int i=0,j=0;

//輸入答案,如果要選中A就輸入1,B = 2,C=3 D=4,每輸完六個人的答案後回車下一題

for(i=1;i<=10;i++) {
printf("第%d題答案有:",i);
for(j=0;j<6;j++){
y[i][j]=0;
scanf("%d",&x[i][j]);
}

}

//循環判斷
for(i=1;i<=10;i++){
for(j=0;j<6;j++){
if(x[i][j] == 1){
y[i][0]++;
}
if(x[i][j] == 2){
y[i][1]++;
}
if(x[i][j] == 3){
y[i][2]++;
}
if(x[i][j] == 4){
y[i][3]++;
}
}
}

for(i=1;i<=10;i++){

printf("第%d題選A的人有 %d 個: ",i,y[i][0]);
printf("-----選B的人有 %d 個: ",y[i][1]);
printf("-----選C的人有 %d 個: ",y[i][2]);
printf("-----選D的人有 %d 個: ",y[i][3]);

}

}

//運行,每個答案輸入六次(我這個是測試,輸入的4次),按回車進入下一題同樣輸入六個人的答案

⑺ 怎樣用C語言統計調查問卷

既然已經實現了,就需要說一下你想怎麼改,不然讓回答者如何提供幫助?
給出一個修改建議吧:原始數據不要從鍵盤輸入,改為從文本文件中讀取,這樣更加接近於實際應用。

⑻ 用C語言設計問卷調查系統,求代碼,華南農業大學軟體工程大一課程設計,華農做過這題目的師兄師姐幫幫忙

C語言設計問卷調查系統這方面的我可以。

⑼ C語言程序設計課程形成性考核冊答案

  1. A

  2. B

  3. B

  4. A