當前位置:首頁 » 課程大全 » 課程設計機房機位預定系統

課程設計機房機位預定系統

發布時間: 2021-02-24 06:41:20

A. 求C語言課程設計《機房管理系統》

#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NULL 0
#define MaxSize 30

typedef struct athletestruct /*運動員*/
{
char name[20];
int score; /*分數*/
int range; /**/
int item; /*項目*/
}ATH;
typedef struct schoolstruct /*學校*/
{
int count; /*編號*/
int serial; /**/
int menscore; /*男選手分數*/
int womenscore; /*女選手分數*/
int totalscore; /*總分*/
ATH athlete[MaxSize]; /**/
struct schoolstruct *next;
}SCH;

int nsc,msp,wsp;
int ntsp;
int i,j;
int overgame;
int serial,range;
int n;
SCH *head,*pfirst,*psecond;
int *phead=NULL,*pafirst=NULL,*pasecond=NULL;

input ()
{
char answer;
head = (SCH *)malloc(sizeof(SCH)); /**/
head->next = NULL;
pfirst = head;
answer = 'y';
while ( answer == 'y' )
{
Is_Game_DoMain:
printf("\nGET Top 5 when odd\nGET Top 3 when even");
printf("\n輸入運動項目序號 (x<=%d):",ntsp);
scanf("%d",pafirst);
overgame = *pafirst;
if ( pafirst != phead )
{
for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ )
{
if ( overgame == *pasecond )
{
printf("\n這個項目已經存在請選擇其他的數字\n");
goto Is_Game_DoMain;
}
}
}
pafirst = pafirst + 1;
if ( overgame > ntsp )
{
printf("\n項目不存在");
printf("\n請重新輸入");
goto Is_Game_DoMain;
}
switch ( overgame%2 )
{
case 0: n = 3;break;
case 1: n = 5;break;
}
for ( i = 1 ; i <= n ; i++ )
{
Is_Serial_DoMain:
printf("\n輸入序號 of the NO.%d (0<x<=%d): ",i,nsc);

scanf("%d",&serial);
if ( serial > nsc )
{
printf("\n超過學校數目,請重新輸入");
goto Is_Serial_DoMain;
}
if ( head->next == NULL )
{
create();
}
psecond = head->next ;
while ( psecond != NULL )
{
if ( psecond->serial == serial )
{
pfirst = psecond;
pfirst->count = pfirst->count + 1;
goto Store_Data;
}
else
{
psecond = psecond->next;
}
}
create();
Store_Data:

pfirst->athlete[pfirst->count].item = overgame;
pfirst->athlete[pfirst->count].range = i;
pfirst->serial = serial; ("Input name:) : ");

scanf("%s",pfirst->athlete[pfirst->count].name);
}
printf("\n繼續輸入運動項目(y&n)?");
answer = getch();
printf("\n");
}
}

calculate() /**/
{
pfirst = head->next;
while ( pfirst->next != NULL )
{
for (i=1;i<=pfirst->count;i++)
{
if ( pfirst->athlete[i].item % 2 == 0 )
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 5;break;
case 2:pfirst->athlete[i].score = 3;break;
case 3:pfirst->athlete[i].score = 2;break;
}
}
else
{
switch (pfirst->athlete[i].range)
{
case 1:pfirst->athlete[i].score = 7;break;
case 2:pfirst->athlete[i].score = 5;break;
case 3:pfirst->athlete[i].score = 3;break;
case 4:pfirst->athlete[i].score = 2;break;
case 5:pfirst->athlete[i].score = 1;break;
}
}
if ( pfirst->athlete[i].item <=msp )
{
pfirst->menscore = pfirst->menscore + pfirst->athlete[i].score;
}
else
{
pfirst->womenscore = pfirst->womenscore + pfirst->athlete[i].score;
}
}
pfirst->totalscore = pfirst->menscore + pfirst->womenscore;
pfirst = pfirst->next;
}
}

output()
{
pfirst = head->next;
psecond = head->next;
while ( pfirst->next != NULL )
{
clrscr();
printf("\n第%d號學校的結果成績:",pfirst->serial);
printf("\n\n項目的數目\t學校的名字\t分數");
for (i=1;i<=ntsp;i++)
{
for (j=1;j<=pfirst->count;j++)
{
if ( pfirst->athlete[j].item == i )
{

printf("\n %d\t\t\t\t\t\t%s\n %d",i,pfirst->athlete[j].name,pfirst->athlete[j].score);break;

}
}
}
printf("\n\n\n\t\t\t\t\t\t按任意建 進入下一頁");
getch();
pfirst = pfirst->next;
}
clrscr();
printf("\n運動會結果:\n\n學校編號\t男運動員成績\t女運動員成績\t總分");
pfirst = head->next;
while ( pfirst->next != NULL )
{
printf("\n %d\t\t %d\t\t %d\t\t %d",pfirst->serial,pfirst->menscore,pfirst->womenscore,pfirst->totalscore);
pfirst = pfirst->next;
}
printf("\n\n\n\t\t\t\t\t\t\t按任意建結束");
getch();
}

create()
{

pfirst = (struct schoolstruct *)malloc(sizeof(struct schoolstruct));
pfirst->next = head->next ;
head->next = pfirst ;

pfirst->count = 1;
pfirst->menscore = 0;
pfirst->womenscore = 0;
pfirst->totalscore = 0;
}
void Save()
{FILE *fp;
if((fp = fopen("school.dat","wb"))==NULL)
{printf("can't open school.dat\n");
fclose(fp);
return;
}
fwrite(pfirst,sizeof(SCH),10,fp);
fclose(fp);
printf("文件已經成功保存\n");
}

main()
{
system("cls");
printf("\n\t\t\t 運動會分數統計\n");
printf("輸入學校數目 (x>= 5):");
scanf("%d",&nsc);
printf("輸入男選手的項目(x<=20):");
scanf("%d",&msp);
printf("輸入女選手項目(<=20):");
scanf("%d",&wsp);
ntsp = msp + wsp;

phead = calloc(ntsp,sizeof(int));
pafirst = phead;
pasecond = phead;
input();
calculate();
output();
Save();
}
另外,虛機團上產品團購,超級便宜

B. 用C語言解決該問題

#include <stdio.h>
void main()
{
int year,month,day,and(int x,int y,int z);
printf("輸入年月日\n");
scanf("%d%d%d",&year,&month,&day);
printf("%d\n",and(year,month,day));
}
int and(int x,int y,int z)
{
int i,j,k=0;
int a[2][13]=,};

if((x%100)&&!(x%4)||!(x%400))i=1;
else i=0;
for(j=0;j<y;j++)
k=k+a[i][j];
k=k+z;
return k;
}

實現思想?先必須知道你要算的天數在年份中有閏年的可能,所以要算閏年是否,當然這有個前提就是如果你算的天數沒超過2月那就可以不用算閏年,if((x%100)&&!(x%4)||!(x%400))這個算閏年的。如果是閏年那麼i=1,這樣就可以確定i=1就是數組a[1][13]里相加。這里放的是閏年每月天數。a[0][13]就放的不是閏年。然後就是天數相加了,用數組你可以很簡單的看出怎麼相加~k=k+z;。

C. 跪求各位大大 幫幫我 謝謝 用C++語言解決機房機位預約模擬系統

我編過類似的程序,是實驗室用的,當時我們同時用asp,java,c語言做三個,這個東東用asp做簡單,用c的話要自己定義一個對應函數,麻煩一點!

D. 幫幫我 謝謝 用C++語言解決機房機位預約模擬系統

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define SJD 6 /*宏定義定義SJD Z NULL D(r)*/
#define Z 20
#define D(s) (s-8)/2 /*將輸入的時間劃分時間段;分別為0,1,2,3,4,5時間段*/
#define NULL 0
struct xinxi{
int jihao;
char xuehao[20];
struct xinxi *next;
}; /*結構函數包含學生信息:機位,學號,還有下名學生信息*/
struct cell{
int RS; /*RS表示總人數*/
struct xinxi *first; /*第一個預訂者記錄*/
struct xinxi *middle; /*等待隊列列表*/
struct xinxi *last; /*最後預訂者記錄*/
} DUILEI[SJD]; /*學生時間(SJD)段順序:人數,第一名學生,排隊的學生,最後一名學生*/
/***************************預定模塊******************************/
void yuding()
{
int n;
char m[20]; /*學號*/
struct xinxi *R;
struct xinxi *p;
printf("輸入想要預定的時間\n");
scanf("%d",&n);
if(n>=8&&n<20){
n=D(n); /*將輸入的時間劃分時間段*/
if(DUILEI[n].RS<Z) /*還有機位可供預訂*/
{
printf("請輸入你的學號\n");
scanf("%s",m);
if(DUILEI[n].first==NULL) /*還沒有人預訂*/
{
R=(struct xinxi *)malloc(sizeof(struct xinxi));/*給R劃分適當的內存*/
R->jihao=1;
strcpy(R->xuehao,m); /*將輸入的學號復制到R->xuehao */
R->next=NULL;
DUILEI[n].first=R;
DUILEI[n].last=R;
DUILEI[n].RS++;
printf("成功預定\n");
}
else
{
R=(struct xinxi *)malloc(sizeof(struct xinxi));
strcpy(R->xuehao,m); /*將輸入的學號復制到R->xuehao */
R->next=NULL;
p= DUILEI[n].last; /*將最後預訂記錄賦值給p*/
R->jihao= DUILEI[n].RS+1;
printf("%d",R->jihao); /*表示該時間段第幾位預訂*/
DUILEI[n].last=R; /*將當前的記錄做為最後記錄以便形成鏈表形式指向下一個*/
p->next=R;
DUILEI[n].RS++; /*記錄人數*/
printf("預定成功\n");
}
}
else printf("沒有空餘機位!\n");
}
else printf("錯誤.請輸入8~19,再次輸入.\n");
}
/
*********************************查詢空位模塊***********************************/
void chaxunkongwei()
{
int n;
printf("輸入想要查詢的時間(8~19點,包括8點)\n");
scanf("%d",&n);
if(n>=8&&n<20)
{
n=D(n);
if(DUILEI[n].RS<Z)
printf("這里還有%d台空電腦!\n",Z-DUILEI[n].RS);
else printf("對不起.沒有空餘機位!\n");
}
else printf("錯誤,請輸入8~19,再次輸入.\n");
}
/*********************查詢預定機位模塊*************************************/
void chaxunyuding()
{
int n;
char m[20];
struct xinxi *R;
printf("輸入查詢時間(8~19點,包括8點)\n");
scanf("%d",&n);
if(n>=8&&n<20)
{
n=D(n);
printf("請輸入學號\n");
scanf("%s",m);
R= DUILEI[n].first; /*將第一名學生的信息賦予R*/
if(DUILEI[n].first==0) printf(" 還沒有人預定\n"); /*判斷有沒有人預訂,如果還沒有人預訂,則輸出還沒有人預定*/
else{
for(;R->next!=NULL;R=R->next) /*從第一名學生開始查詢直到找到符合的學號,以便確認是否預訂*/
if(strcmp(R->xuehao,m)==0)break;
if(R->jihao!=0) /*已預訂,輸出相應的信息*/
printf("你的機位是%d\n",R->jihao);
else printf("對不起.你依舊在等待列表中或者沒有預定");
}
}
else printf("錯誤,請再次輸入.\n");
}
/*****************************排隊系統模塊**************************************/
void paiixitong()
{
int n;
char m[20];
struct xinxi *R; struct xinxi *p;
printf("請輸入想要排隊的時間\n");
scanf("%d",&n);
if(n>=8&&n<20)
{
n=D(n);
if(DUILEI[n].RS>=Z) /*該時間段沒有空位機,需要預訂等待*/
{
printf("請輸入你的學號\n"); scanf("%s",m);
if((DUILEI[n].RS)==Z)
{
R=(struct xinxi *)malloc(sizeof(struct xinxi));
strcpy(R->xuehao,m);
R->next=NULL;
R->jihao=0;
p= DUILEI[n].last;
DUILEI[n].last=R;
p->next=R;
DUILEI[n].middle=R; /*等待預訂列表*/
DUILEI[n].RS++;
printf("成功排隊\n");
}/*將剛輸入學生信息拍到最後一名後,成最後一名*/
else
{
R=(struct xinxi *)malloc(sizeof(struct xinxi));
strcpy(R->xuehao,m);
R->next=NULL;
R->jihao=0;
p= DUILEI[n].last;
DUILEI[n].last=R;
p->next=R;
DUILEI[n].RS++;
printf("成功排隊\n");
}
}
else printf("有空餘機位,無須等待\n");
}
else printf("錯誤.再次輸入.\n");
}

/******************************取消預訂模塊****************************************/
void cancel()
{
int n;
int i;
char m[20];
struct xinxi *R;
struct xinxi *q;
struct xinxi *p;
printf("請輸入預定的時間\n");
scanf("%d",&n);
if(n>=8&&n<20)
{
printf("請輸入你的學號!\n");
scanf("%s",m);
n=D(n);
R= DUILEI[n].first;
q=R;
for(i=1;;q=R,R=R->next,i++) /*查找符合信息*/
if(strcmp(R->xuehao,m)==0)break;
if(i>Z) /*i>z表示在等待列表中*/
{
if(R->next==NULL)
{
q->next=NULL;
DUILEI[n].last=q;
free(R);
DUILEI[n].RS--;
printf("取消成功!\n"); /*如果是排在20名後,且是最後一名*/
}
else{
q->next=R->next;
free(R);
DUILEI[n].RS--;
printf("取消成功!\n"); /*如果排在20名後,但不是最後*/
}
}
else /*正在上機者取消預訂*/
{
if(DUILEI[n].RS>Z)
{
DUILEI[n].middle->jihao=R->jihao;
DUILEI[n].middle= DUILEI[n].middle->next;
} /*如果排在20名內,但總人數(包括等待列表人數)大於20 */
if(i==1) DUILEI[n].first=R->next;
else q->next=R->next;
free(R);
DUILEI[n].RS--;
printf("成功取消預定!\n");
}
}
else printf("錯誤,請再次輸入.\n");
}
/********************************待機者列表模塊****************************/
void daijizheliebiao()
{
int n;
struct xinxi *q; (定義學生的信息)
printf("查詢其他等待者的預定時間\n");
scanf("%d",&n);
if(n>=8&&n<20)
{
n=D(n);
if(DUILEI[n].RS>Z) /*表示有等待上機者*/ (判斷人數是否大)
{
printf("等待列表:\n");
q=DUILEI[n].middle;
for(;q->next!=NULL;q=q->next) printf("%s\n",q->xuehao); /*逐個輸出等待列表者信息*/
printf("%s\n", DUILEI[n].last->xuehao);
}
else printf("這個時間段沒有預定者\n");
}
else printf("錯誤。請再次輸入.\n");
}
int main()
{
int i;
for(i=0;i<SJD;i++){
DUILEI[i].RS=0; (定義)
DUILEI[i].first=NULL; 第一個
DUILEI[i].middle=NULL; 排隊ing
DUILEI[i].last=NULL; 最後一名
}
while(1){
printf(" **************************************\n");
printf(" * 機房機位預定系統 *\n");
printf(" * *\n");
printf(" * 1 查詢空機位 2 預定系統 *\n");
printf(" * 3 取消預定 4 查詢所預定機位 *\n");
printf(" * 5 排隊系統 6 等機者列表 *\n");
printf(" * 0 退出系統 *\n");
printf(" * *\n");
printf(" * 請輸入序號(0--6): *\n");
printf(" **************************************\n");
printf("請輸入序號!:\n");
scanf("%d",&i);
switch(i)
{
case 1:chaxunkongwei();break;
case 2:yuding();break;
case 3:cancel();break;
case 4:chaxunyuding();break;
case 5:paiixitong();break;
case 6:daijizheliebiao();break;
case 0:exit(0);
default:printf("錯誤\n");
}
}
return 0;
}

E. 求C++程序設計代碼——機房預約管理系統

iaeuriut39qt93450380498 345

F. C語言課程設計——機房上機管理系統

還是自己做吧,畢竟也是個課程設計,練習一下也好啊,況且也不是很麻煩.

如果沒有"各位大俠,速度幫忙~~要不我就死定了~~ ",我可能會寫的.

建議看看
http://community.csdn.net/IndexPage/SmartQuestion.aspx

G. c++數據結構課程設計 機房機位預定系統

程設計 機房機位預定系統
了解比較多地行情地

H. c++課程設計:機房機位預訂系統 大神在哪裡,仰望之!!!

錢啊! 30元,一手交錢 一手交貨,現在不要什麼網路分數,老子幾百分,給你都可以,~!

I. 如何用c語言編寫機房機位預訂系統

功能:創建鏈表,此函數帶回一個指向鏈表頭的指針*/ { score*head; score *p1,*p2,*p3,*max; int i,j; float fen; char t[10]; n=0; p1=p2=p3=(score *)malloc(LEN);head=p3; /*申請一個新單元*/ printf("請輸入學生資料,輸0退出!\n"); repeat1: printf("請輸入學生學號(學號應大於0):");/*輸入大於0的學號*/ scanf("%d",&p1->number); while(p1->number<0) { getchar(); printf("輸入錯誤,請重新輸入學生學號:"); scanf("%d",&p1->number); } /*輸入學號為字元或小於0時,程序報錯,提示重新輸入學號*/ if(p1->number==0) goto end;/*當輸入的學號為0時,轉到末尾,結束創建鏈表*/ else { p3=head; if(n>0) { for(i=0;inumber!=p3->number) p3=p3->next; else { printf("學號重復,請重輸!\n"); goto repeat1; /*當輸入的學號已經存在,程序報錯,返回前面重新輸入*/ } } } } printf("請輸入學生姓名:"); scanf("%s",&p1->name); /*輸入學生姓名*/ printf("請輸入cj1(0~100):"); /*輸入cj1,成績應在0-100*/ scanf("%f",&p1->cj1); while(p1->cj1<0||p1->cj1>100) { getchar(); printf("輸入錯誤,請重新輸入cj1"); /*輸入錯誤,重新輸入成績1*/ scanf("%f",&p1->cj1); } printf("請輸入cj2(0~100):"); /*輸入cj2,成績應在0-100*/ scanf("%f",&p1->cj2); while(p1->cj2<0||p1->cj2>100) { getchar(); printf("輸入錯誤,請重新輸入cj2"); /*輸入錯誤,重新輸入cj2直到正確為止*/ scanf("%f",&p1->cj2); } printf

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919