久久99精品久久久久久琪琪,久久人人爽人人爽人人片亞洲,熟妇人妻无码中文字幕,亚洲精品无码久久久久久久

王爽語言課程設計一代碼

時間:2019-05-12 16:50:58下載本文作者:會員上傳
簡介:寫寫幫文庫小編為你整理了多篇相關的《王爽語言課程設計一代碼》,但愿對你工作學習有幫助,當然你在寫寫幫文庫還可以找到更多《王爽語言課程設計一代碼》。

第一篇:王爽語言課程設計一代碼

assume cs:code data segment;0-83H db '1975','1976','1977','1978','1979','1980','1981','1982','1983' db '1984','1985','1986','1987','1988','1989','1990','1991' ,'1992' db '1993','1994','1995'

;84H-0a7h dd 16,22,382,1356,2390,8000,16000,24486,50065,97479,140417,197514 dd 345980,590827,803530,1183000,1843000,2759000,3753000,4649000,5937000

dd 3,7,9,13,28,38,130,220,476,778,1001,1442,2258,2793,4037,5635,8226 dd 11542,14430,15257,17800 data ends

b segment db 32 dup(0)b ends

stack segment dw 32 dup(0)stack ends

code segment start:

mov ax,data

;init ds,ss

mov ds,ax

mov ax,stack

mov ss,ax

mov sp,32

;bx--第幾組 si--年份,人數,雇員

di--顯示位置

mov bx,0

mov si,0

mov di,0

mov cx,21 lp:

push cx

;-------------------------

;年份

mov cx,4;內循環(huán)次數

mov si,bx

call show_str

;-------------------------

;-------------------------

;收入

mov si,bx

add si,84

;si指向下一個段

call dtoc

push ax

;

push ds

push si

push di

mov ax,b

mov ds,ax

mov si,0

add di,40

call show_str

pop di

pop si

pop ds

pop ax

;-------------------------

;-------------------------

;收入

mov si,bx

add si,84

add si,84

;pointer to employee 當employee定義為dd時,才能如此尋址,dw時,尋址不正確

call dtoc2

push ax

;pointer to data src

push dx

push si

push di

mov ax,b

mov ds,ax

mov si,0

add di,80

call show_str

pop di

pop si

pop ds

pop ax

jmp mcon

;-------------------------

help:

jmp lp

;-------------------------

;平均

mcon:

mov ax,data

mov ds,ax

mov si,bx

;初始化 num1

add si,84

mov ax,ds:[si]

add si,2

mov dx,ds:[si]

mov si,bx

;初始化 num2

add si,84

add si,84

;當employee定義為dd時,才能如此尋址,dw時,尋址不正確

mov cx,ds:[si]

call divdw

push ds

;存放結果

push si

push di

push cx

push ax

mov ax,b

mov ds,ax

mov si,0

pop ax

mov ds:[si],ax

add si,2

;inc si ?

mov ds:[si],dx

mov si,0

call dtoc

add di,120

;顯示結果

call show_str

pop cx

pop di

pop si

pop ds

;-------------------------

add di,160

;inc bx

add bx,4

pop cx

loop help

mov ax,4c00H

int 21H

;主函數結束

;---------------;-dtoc2

-;-params ds,si--src num(num1 16 bit)

-;-return B Segment save num cx--num Length

-;---------------dtoc2:

push ds

push si

push ax

push bx

dc2:

mov bx,0

;save length

mov ax,ds:[si]

;初始化 num1

mov dx,0 dccon2:

mov cx,10

;初始化 num2

call divdw

add cx,30H

push cx

;save extra

inc bx

push ax

or ax,dx

mov cx,ax

pop ax

jcxz dcok2

jmp dccon2

dcok2:

mov cx,bx

mov ax,b

mov ds,ax

mov si,0 dcsav2:

pop ds:[si]

inc si

loop dcsav2

mov cx,bx

;result cx--length

pop bx

pop ax

pop si

pop ds

ret

;---------------;-dtoc

-;-params ds,si--src num(num1 32 bit)

;-params cx--length of str ds,si--src di--destination pos

-;---------------show_str: push es

push ax

push si

push di

push bx

push cx

mov ax,0b800H;顯存地址

mov es,ax

mov bl,7

;顏色

sstr:

mov al,ds:[si]

mov es:[di],al

inc di

mov es:[di],bl

inc di

inc si

loop sstr

pop cx

pop bx

pop di

pop si

pop ax

pop es

ret

;---------------;-除法函數

;-余數--cx

-;---------------divdw: push bx

ddw:

push ax

mov ax,dx

mov dx,0

div cx;商在ax中、余數在dx中

mov bx,ax

pop ax

div cx

mov cx,dx

mov dx,bx

pop bx

ret

code ends end start

第二篇:C語言課程設計代碼

#include “stdio.h” #include #include #define LEN sizeof(struct course)struct course { int cID;char name[50];float credit;int semester;struct course *next;};

void main(){ int n=0;struct course *head=NULL;void insert(struct course **head,struct course *cou);void Print(struct course **head,int *n);void Modify(struct course **head,int *n);void Require(struct course **head);void Creat(struct course **head,int *n);void Delete(struct course **head,int *n);void Fun(struct course **head,int *n);

Fun(&head,&n);}

void insert(struct course **head,struct course *cou){ struct course *p0,*p1,*p2;p2=p1=*head;p0=cou;if(*head){

while((p0->semester>p1->semester)&&(p1->next))

{

p2=p1;

p1=p1->next;

}

if(p0->semester

semester)

{

if(*head==p1)*head=p0;

else p2->next=p0;

p0->next=p1;}

else

{

if(p0->semester==p1->semester){ while((p0->cID>p1->cID)&&(p1->next)&&(p0->semester==p1->semester))

{

} if(p0->semester!=p1->semester){

} else {

if(p0->cID<=p1->cID){

if(*head==p1)*head=p0;else p2->next=p0;p2=p1;p1=p1->next;p2->next=p0;p0->next=p1;

p0->next=p1;

}

else

{p1->next=p0;p0->next=NULL;}

}

}

else

{p1->next=p0;p0->next=NULL;}

} } else

{

*head=p0;

p0->next=NULL;} }

void Print(struct course **head,int *n){ struct course *p;p=*head;if(*head){

if(*n==1)printf(“nThis %d record is:n”,*n);

else printf(“nThese %d records are:n”,*n);

printf(“semester cID

name

creditn”);

do

{ printf(“%-10d%-10d%-18s%-12.1f n”,p->semester,p->cID,p->name,p->credit);

p=p->next;

}while(p!=NULL);} else printf(“nList null!n”);}

void Modify(struct course **head,int *n){ struct course *p,*p2;int cID;if(*head){

Print(head,n);while(1){ printf(“nPlease input the cID which you want to modify:”);

scanf(“%d”,&cID);p2=p=*head;while(p->next&&(cID!=p->cID)){

p2=p;

p=p->next;} if(cID==p->cID){

printf(“Please input the new cID(1~60):”);

scanf(“%d”,&p->cID);

while(p->cID<0||p->cID>60)

{

printf(“nError!”);

printf(“nPlease input the new cID(1~60):”);

scanf(“%d”,&p->cID);

}

printf(“Please input the new semester(1~8):”);

scanf(“%d”,&p->semester);while(p->semester<0||p->semester>8)

{

printf(“nError!”);

printf(“nPlease input the new semester(1~8):”);

scanf(“%d”,&p->semester);

}

printf(“Please input the new credit:”);

scanf(“%f”,&p->credit);

printf(“Please input the new name:”);

scanf(“%s”,p->name);

if(p==*head)*head=p->next;

else p2->next=p->next;

insert(head,p);

break;

}

else printf(“%d not been found!n”,cID);

} } else {printf(“nList null!n”);} }

void Require(struct course **head){ struct course *p;float sum=0;int sem,i=0;printf(“nPlease input the semester which is required:”);

scanf(“%d”,&sem);p=*head;while(p){

if(sem==p->semester)

{

i++;if(i==1)printf(“nsemester cID

name

creditn”);printf(“%-10d%-10d%-18s%-12.1f n”,p->semester,p->cID,p->name,p->credit);

sum=sum+p->credit;

}

p=p->next;} printf(“The sum of credit in this term is:%.1fn”,sum);}

void Creat(struct course **head,int *n){ struct course *p1;while(1){

p1=(struct course *)malloc(LEN);

printf(“Please input the cID(1~60):”);

scanf(“%d”,&p1->cID);

while(p1->cID<0||p1->cID>60)

{

printf(“nError!”);

printf(“nPlease input the cID(1~60):”);

scanf(“%d”,&p1->cID);

}

if(p1->cID==0)break;

printf(“Please input the semester(1~8):”);

scanf(“%d”,&p1->semester);

while(p1->semester<0||p1->semester>8)

{

printf(“nError!”);

printf(“nPlease input the semester(1~8):”);scanf(“%d”,&p1->semester);

}

} } printf(“Please input the credit:”);scanf(“%f”,&p1->credit);printf(“Please input the name:”);scanf(“%s”,p1->name);insert(head,p1);*n=*n+1;printf(“nYou can continue until the cID is ”0“!n”);Print(head,n);void Delete(struct course **head,int *n){

struct course *p1,*p2;int cID;Print(head,n);if(*head){ printf(“Please input the cID of the course which you want to delete:”);scanf(“%d”,&cID);p1=*head;

while(cID!=p1->cID&&p1->next!=NULL)

{

p2=p1;

p1=p1->next;

}

if(cID==p1->cID)

{

if(p1==*head)*head=p1->next;

else p2->next=p1->next;

printf(“Have delete cID:%dn”,cID);

*n=*n-1;

}

else printf(“%d not been found!n”,cID);} }

void Fun(struct course **head,int *n){ char num;

while(1)

{

system(“cls”);

puts(“**************** Main Menu ******************”);

puts(“* 1.Add Records

2.Print Records

*”);

puts(“* 3.Delete Records

4.Modify Records *”);

puts(“* 5.Require Records 6.Exit

*”);

printf(“Please input your choice: ”);

scanf(“%d”,&num);

switch(num)

{

case 1:Creat(head,n);break;

case 2:Print(head,n);break;

case 3:Delete(head,n);break;

case 4:Modify(head,n);break;

case 5:Require(head);break;case 6:exit(0);break;

default: break;

}

printf(“nPress ”Enter“ to continue!”);getchar();getchar();

} }

第三篇:C語言課程設計《高速公路聯網收費系統(tǒng)》代碼

作者:吳俠志

就讀院校:東莞理工學院

#include “stdafx.h” #define NUM 4 #define max_len 8 #include #include #include #include #include #include

char *mytime(struct tm *timeptr);

//獲取系統(tǒng)時間的函數 void Delay(int n);//延時函數 char *filename(int startkey);void initialize(struct car *cars,int num,FILE *fp);///初始化函數 int refer(struct car *cars,int startkey);//查詢

int km[10]={0,0,82,162,288,368,391,514,800,867};

/* 記錄各站與首站的里程,單位:km */ double price[6]={0.0,0.6,1.2,1.8,2.4,3.0};

/* 記錄各類車的里程價位,單位:元/輛公里 */ char *address[10]={“0”,“湛江”,“茂名”,“陽江”,“開平”,“佛山”,“廣州”,“深圳”,“汕頭”,“汾水”};char *kind[6]={“特殊車”,“一類車”,“二類車”,“三類車”,“四類車”,“五類車”};

struct car { int card_num;

/* 卡號 */ int car_type;int station_in;char time_in[26];int station_out;char time_out[26];char is_in;double money;int flag;}cars[9*NUM+1];

int num=0;int pass=0;int main(int argc, char* argv[]){ int i,key,choice,j,k,m,size;double pay,money;char enter,pwd[max_len+1],password[max_len+1],ch;FILE *fp;fp=fopen(“標記.txt”,“a+”);fclose(fp);

fp=fopen(“記錄.txt”,“a+”);

fclose(fp);

printf(“t歡迎登錄廣東同三高速公路聯網收費系統(tǒng)n”);printf(“┏━━━━━━━━━━━━━━━━━━━━┓n”);printf(“┃

1.湛江

2.茂名

3.陽江

┃n”);printf(“┃

4.開平

5.佛山

6.廣州

┃n”);printf(“┃

7.深圳

8.汕頭

9.汾水關

┃n”);printf(“┗━━━━━━━━━━━━━━━━━━━━┛n”);printf(“請選擇所在站點,并輸入該序號:”);int startkey;while(1){

fflush(stdin);

while(scanf(“%d%c”,&startkey,&enter)==0 || enter!='n')

{

printf(“terror!!input again:”);

fflush(stdin);

}

if(startkey==1 || startkey==2 || startkey==3 || startkey==4 || startkey==5 || startkey==6 || startkey==7 || startkey==8 || startkey==9)

{

break;

}

else

{

printf(“terror!!input again:”);

continue;

} } printf(“初始化中……”);

fp=fopen(“標記.txt”,“a+”);fscanf(fp,“%d”,&num);fclose(fp);

fp=fopen(“password.txt”,“a+”);fscanf(fp,“%d”,&pass);fclose(fp);if(pass==0)

{

} fp=fopen(“password.txt”,“w+”);fprintf(fp,“%d”,88888888);fclose(fp);

fp=fopen(“記錄.txt”,“a+”);rewind(fp);initialize(cars,num,fp);

fclose(fp);Delay(5);time_t timer;struct tm *tblock,*a;timer=time(NULL);a=localtime(&timer);while(1){ system(“cls”);fflush(stdin);printf(“所在地:%s站n登錄時間:%sn”,address[startkey],mytime(a));printf(“┏━━━━━━━━━━━━━━━━━━━━━┓n”);printf(“┃

1.發(fā)卡

┃n”);printf(“┃

2.檢卡并收費

┃n”);printf(“┃

3.查詢

┃n”);printf(“┃

4.注銷并退出系統(tǒng)

┃n”);printf(“┃

5.退出系統(tǒng)

┃n”);printf(“┗━━━━━━━━━━━━━━━━━━━━━┛n”);printf(“請選擇,并輸入序號:”);while(1){

while(scanf(“%d%c”,&key,&enter)==0 || enter!='n')

{

printf(“terror!!input again:”);

fflush(stdin);

}

fp=fopen(“標記.txt”,“r+”);

fscanf(fp,“%d”,&num);

fclose(fp);

fp=fopen(“記錄.txt”,“r+”);

rewind(fp);

initialize(cars,num,fp);

fclose(fp);

j=0;

for(i=1;i<=9*NUM;i++){

if(cars[i].is_in=='y' && cars[i].station_in!=startkey && cars[i].station_out==0)

{

j++;

break;

} } k=0;for(m=1;m<=9*NUM;m++){

if(cars[m].is_in=='n' && cars[m].station_in==0 && cars[m].station_out==startkey)

{

k++;

cars[m].flag=k;

} } if((key==1 && k>0)||(key==2 && j>0)|| key==3 || key==4 || key==5)break;else if(key==2 && j==0){

printf(“t目前尚無車輛要離站!!input again:”);

fflush(stdin);

continue;} else if(key==1 && k==0){

printf(“t目前卡片不足!!input again:”);

fflush(stdin);

continue;} else {

printf(“terror!!input again:”);

fflush(stdin);

continue;} } if(key==1){ system(“cls”);timer=time(NULL);tblock=localtime(&timer);srand((unsigned)time(NULL));//用即時的系統(tǒng)時間來做隨機數種子.生成隨機數

choice=(rand()%k)+1;//隨機生成choice,格式rand()%k即要求產生k以內的

for(m=1;m<=9*NUM;m++)

{

if(cars[m].is_in=='n' && cars[m].station_in==0 && cars[m].station_out==startkey && cars[m].flag==choice)

{

break;

}

}

printf(“卡號是:%dn現在時間是:%sn”,m,mytime(tblock));

cars[m].station_in=startkey;

cars[m].station_out=0;

strcpy(cars[m].time_in,mytime(tblock));

strcpy(cars[m].time_out,“無”);

num=1;

fp=fopen(“標記.txt”,“w+”);

fprintf(fp,“%d”,num);

fclose(fp);

fp=fopen(“記錄.txt”,“w+”);

for(i=1;i<=9*NUM;i++)

{

fprintf(fp,“%d %d %c %lf %d %d %st%stn”,cars[i].card_num,cars[i].car_type,cars[i].is_in,cars[i].money,cars[i].station_in,cars[i].station_out,cars[i].time_in,cars[i].time_out);

}

fclose(fp);

printf(“┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓n”);

printf(“┃0.特殊車:軍警車、緊急車

┃n”);

printf(“┃1.一類車:小轎車、吉普車、的士頭人貨車、摩托車

┃n”);

printf(“┃2.二類車:面包車、小型人貨車、輕型貨車、小型客車

┃n”);

printf(“┃3.三類車:中型客車、大型普通客車、中型貨車、大型豪華客車┃n”);

printf(“┃4.四類車: 大型貨車、大型拖(掛)車、20英尺集裝箱車

┃n”);

printf(“┃5.五類車: 重型貨車、重型拖(掛)車、40英尺集裝箱車

┃n”);

printf(“┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛n”);

printf(“請選擇車型,并輸入序號:”);

while(1)

{

fflush(stdin);

while(scanf(“%d%c”,&size,&enter)==0 || enter!='n')

{

printf(“terror!!input again:”);

fflush(stdin);

}

if(size==0 || size==1 || size==2 || size==3 || size==4 || size==5)break;

else

{

printf(“terror!!input again:”);

continue;

}

}

cars[m].is_in='y';

cars[m].car_type=size;

fp=fopen(filename(startkey),“a+”);

fprintf(fp,“%30s%8d%12s%20snn”,mytime(tblock),m,kind[cars[m].car_type],“發(fā)卡,放行”);

fclose(fp);

fp=fopen(“標記.txt”,“w+”);

fprintf(fp,“%d”,num);

fclose(fp);

fp=fopen(“記錄.txt”,“w+”);

for(i=1;i<=9*NUM;i++)

{

fprintf(fp,“%d %d %c %lf %d %d %st%stn”,cars[i].card_num,cars[i].car_type,cars[i].is_in,cars[i].money,cars[i].station_in,cars[i].station_out,cars[i].time_in,cars[i].time_out);

}

fclose(fp);

printf(“登記完畢,請發(fā)卡放行,并按任意鍵回到主菜單a”);

getche();

}

else if(key==2)

{

system(“cls”);

printf(“請輸入卡號(按0返回):”);

while(1)

{

ch='y';

fflush(stdin);

while(scanf(“%d%c”,&choice,&enter)==0 || enter!='n')

{

printf(“terror!!input again:”);

fflush(stdin);

}

fp=fopen(“標記.txt”,“r+”);

fscanf(fp,“%d”,&num);

fclose(fp);

fp=fopen(“記錄.txt”,“r+”);

rewind(fp);

initialize(cars,num,fp);

fclose(fp);

if(choice<0 || choice>9*NUM)

{

printf(“無此卡號...ntinput again:”);

continue;

}

else if(choice==0)

{

ch='n';

break;

}

else if(choice>0 && choice<=9*NUM && cars[choice].is_in=='n')

{

printf(“該卡號尚未發(fā)布...ntinput again:”);

continue;

}

else if(choice>0 && choice<=9*NUM && cars[choice].is_in=='y' && cars[choice].station_in!=startkey && cars[choice].station_out==0)

{

break;

}

else if(choice>0 && choice<=9*NUM && cars[choice].is_in=='y' && cars[choice].station_in==startkey && cars[choice].station_out==0)

{

printf(“該卡號車于%s從本站進入高速,尚在行...ntinput again:”,cars[choice].time_in);

continue;

}

else

{

printf(“terror!!input again:”);

continue;

}

}

if(ch=='n')continue;

cars[choice].station_out=startkey;

fp=fopen(“記錄.txt”,“w+”);

for(i=1;i<=9*NUM;i++)

{

fprintf(fp,“%d %d %c %lf %d %d %st%stn”,cars[i].card_num,cars[i].car_type,cars[i].is_in,cars[i].money,cars[i].station_in,cars[i].station_out,cars[i].time_in,cars[i].time_out);

}

fclose(fp);

if(cars[choice].car_type==0)

{

printf(“該車于%s在%s進入高速,為特殊車,無需收費n”,cars[choice].time_in,address[cars[choice].station_in]);

}

else

{

i=abs(km[cars[choice].station_in]-km[cars[choice].station_out]);

money=cars[choice].money=i*price[cars[choice].car_type];

printf(“該車于%s在%s進入高速,需繳費%.1lf款:”,cars[choice].time_in,address[cars[choice].station_in],cars[choice].money);

fflush(stdin);

while(1)

{

while(scanf(“%lf%c”,&pay,&enter)==0 || enter!='n')

{

printf(“terror!!input again:”);

fflush(stdin);

}

if(pay>money)

{

printf(“繳付%.1lf元,找零%.1lf元...n”,pay,pay-money);

money=0;

break;

}

else if(pay

{

money=money-pay;

printf(“繳付%.1lf元,需再繳付%.1lf元:”,pay,money);

continue;

}

else

{

printf(“已繳費完畢,共收取人民幣%.1lf元...n”,cars[choice].money);

break;

}

}

}

timer=time(NULL);

tblock=localtime(&timer);

printf(“現在時間是:%sn”,mytime(tblock));

strcpy(cars[choice].time_out,mytime(tblock));

元,請付

fp=fopen(“檔案.txt”,“a+”);

fprintf(fp,“%5d%12s%15s%30s%10.1lf元n”,choice,kind[cars[choice].car_type],address[cars[choice].station_in],cars[choice].time_in,cars[choice].money);

fprintf(fp,“%32s%30snn”,address[cars[choice].station_out],cars[choice].time_out);

fclose(fp);

cars[choice].money=0;

cars[choice].is_in='n';

cars[choice].station_in=0;

cars[choice].station_out=startkey;

strcpy(cars[choice].time_in,“無”);

strcpy(cars[choice].time_out,“無”);

fp=fopen(filename(startkey),“a+”);

if(cars[choice].car_type==0)fprintf(fp,“%30s%8d%12s%20snn”,mytime(tblock),choice,kind[cars[choice].car_type],“收卡,放行”);

else fprintf(fp,“%30s%8d%12s%20snn”,mytime(tblock),choice,kind[cars[choice].car_type],“繳費,收卡,放行”);

fclose(fp);

cars[choice].car_type=0;

fp=fopen(“記錄.txt”,“w+”);

for(i=1;i<=9*NUM;i++)

{

fprintf(fp,“%d %d %c %lf %d %d %st%stn”,cars[i].card_num,cars[i].car_type,cars[i].is_in,cars[i].money,cars[i].station_in,cars[i].station_out,cars[i].time_in,cars[i].time_out);

}

fclose(fp);

printf(“請收卡放行,并按任意鍵回到主菜單a”);

getche();

}

else if(key==3)

{

system(“cls”);

refer(cars,startkey);

}

else if(key==4)

{

while(1)

{

system(“cls”);

printf(“input password: ”);

for(i=0;;)

{

fflush(stdin);

ch=getch();if(ch=='r' || ch=='n')

{

break;} else if(ch=='b'){

if(i-->0)

{

pwd[i]='

主站蜘蛛池模板: 国产成人综合久久亚洲精品| 成人亚洲一区无码久久| 麻豆av一区二区天美传媒| 国产精品美女久久久久久久久| 果冻传媒2021精品一区| 精品乱码一区二区三区四区| 丰满人妻妇伦又伦精品国产| 免费国产线观看免费观看| 98国产精品综合一区二区三区| 国产露脸150部国语对白| 午夜理论片yy8860y影院| 97在线视频免费人妻| 国产精品一国产精品一k频道| 久久久亚洲精品成人| 亚洲日韩在线a视频在线观看| 亚洲国产精品久久人人爱| 欧美性猛交????P30| 国精品午夜福利视频不卡757| 久久不见久久见免费影院| 97国产精东麻豆人妻电影| 18禁止看的免费污网站| 少妇人妻偷人精品一区二区| 亚洲精品久久久www小说| 国产精品亚洲专区无码第一页| 久久精品无码一区二区三区不卡| 小泽玛利亚一区二区免费| 97碰碰碰免费公开在线视频| 内射人妻视频国内| 少妇真人直播app| 欧美精品偷自拍另类在线观看| 亚洲av无码国产一区二区三区| 国产剧情av麻豆香蕉精品| 久久精品一区二区av999| 国产97在线 | 亚洲| 牲欲强的熟妇农村老妇女视频| 久久精品免视看国产成人明星| 玩弄人妻少妇500系列视频| 国产免费一区二区三区vr| 亚洲精品无码久久不卡| 少妇高潮尖叫黑人激情在线| 激情偷乱人伦小说视频|