#include <malloc.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define NULL 0 #define MaxSize 30 typedef struct athletestruct /*運(yùn)動(dòng)員*/ { char name[20]; int score; /*分?jǐn)?shù)*/ int range; /**/ int item; /*項(xiàng)目*/ }ATH; typedef struct schoolstruct /*學(xué)校*/ { int count; /*編號(hào)*/ int serial; /**/ int menscore; /*男選手分?jǐn)?shù)*/ int womenscore; /*女選手分?jǐn)?shù)*/ 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; void create(); void 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輸入運(yùn)動(dòng)項(xiàng)目序號(hào) (x<=%d):",ntsp); scanf("%d",pafirst); overgame = *pafirst; if ( pafirst != phead ) { for ( pasecond = phead ; pasecond < pafirst ; pasecond ++ ) { if ( overgame == *pasecond ) { printf("\n這個(gè)項(xiàng)目已經(jīng)存在請(qǐng)選擇其他的數(shù)字\n"); goto Is_Game_DoMain; } } } pafirst = pafirst + 1; if ( overgame > ntsp ) { printf("\n項(xiàng)目不存在"); printf("\n請(qǐng)重新輸入"); 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輸入序號(hào) of the NO.%d (0<x<=%d): ",i,nsc); scanf("%d",&serial); if ( serial > nsc ) { printf("\n超過(guò)學(xué)校數(shù)目,請(qǐng)重新輸入"); 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; printf("Input name:) : "); scanf("%s",pfirst->athlete[pfirst->count].name); } printf("\n繼續(xù)輸入運(yùn)動(dòng)項(xiàng)目(y&n)?"); answer = getchar(); printf("\n"); } } void 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; } } void output() { pfirst = head->next; psecond = head->next; while ( pfirst->next != NULL ) { // clrscr(); printf("\n第%d號(hào)學(xué)校的結(jié)果成績(jī):",pfirst->serial); printf("\n\n項(xiàng)目的數(shù)目\t學(xué)校的名字\t分?jǐn)?shù)"); 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按任意建 進(jìn)入下一頁(yè)"); getchar(); pfirst = pfirst->next; } // clrscr(); printf("\n運(yùn)動(dòng)會(huì)結(jié)果:\n\n學(xué)校編號(hào)\t男運(yùn)動(dòng)員成績(jī)\t女運(yùn)動(dòng)員成績(jī)\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按任意建結(jié)束"); getchar(); } void 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("文件已經(jīng)成功保存\n"); } void main() { system("cls"); printf("\n\t\t\t 運(yùn)動(dòng)會(huì)分?jǐn)?shù)統(tǒng)計(jì)\n"); printf("輸入學(xué)校數(shù)目 (x>= 5):"); scanf("%d",&nsc); printf("輸入男選手的項(xiàng)目(x<=20):"); scanf("%d",&msp); printf("輸入女選手項(xiàng)目(<=20):"); scanf("%d",&wsp); ntsp = msp + wsp; phead = (int *)calloc(ntsp,sizeof(int)); pafirst = phead; pasecond = phead; input(); calculate(); output(); Save(); }
標(biāo)簽: 源代碼
上傳時(shí)間: 2016-12-28
上傳用戶(hù):150501
#include<stdio.h> #include<windows.h> int xuanxiang; int studentcount; int banjihao[100]; int xueqihao[100][10]; char xm[100][100]; int xuehao[100][10]; int score[100][3]; int yuwen; int shuxue[000]; int yingyu[100]; int c[100]; int p; char x[1000][100]="",y[100][100]="";/*x學(xué)院 y專(zhuān)業(yè) z班級(jí)*/ int z[100]; main() { void input(); void inputsc(); void alter(); void scbybannji(); printf("--------學(xué)生成績(jī)管理-----\n"); printf("請(qǐng)按相應(yīng)數(shù)字鍵來(lái)實(shí)現(xiàn)相應(yīng)功能\n"); printf("1.錄入學(xué)生信息 2.錄入學(xué)生成績(jī) 3.修改學(xué)生成績(jī)\n"); printf("4.查詢(xún)學(xué)生成績(jī) 5.不及格科目及名單 6.按班級(jí)輸出學(xué)生成績(jī)單\n"); printf("請(qǐng)輸入你要實(shí)現(xiàn)的功能所對(duì)應(yīng)的數(shù)字:"); scanf("%d",&xuanxiang); system("cls"); getchar(); switch (xuanxiang) { case 1:input(); case 2:inputsc(); case 3:alter(); /*case 4:select score(); case 5:bujigekemujimingdan();*/ case 6:scbybanji; } } void input() { int i; printf("請(qǐng)輸入你的學(xué)院名稱(chēng):"); gets(x); printf("請(qǐng)輸入你的專(zhuān)業(yè)名稱(chēng):"); gets(y); printf("請(qǐng)輸入你的班級(jí)號(hào):"); scanf("%d",&z); printf("請(qǐng)輸入你們一個(gè)班有幾個(gè)人:"); scanf("%d",&p); system("cls"); for(i=0;i<p;i++) { printf("請(qǐng)輸入第%d個(gè)學(xué)生的學(xué)號(hào):",i+1); scanf("%d",xuehao[i]); getchar(); printf("請(qǐng)輸入第%d個(gè)學(xué)生的姓名:",i+1); gets(xm[i]); system("cls"); } printf("您已經(jīng)錄入完畢您的班級(jí)所有學(xué)生的信息!\n"); printf("您的班級(jí)為%s%s%s\n",x,y,z); /*alter(p);*/ } void inputsc() { int i; for(i=0;i<p;i++) { printf("\n"); printf("--------------------------------------------------------------------------------\n\n"); printf("\t\t\t\t錄入學(xué)生的成績(jī)\n\n\n"); printf("--------------------------------------------------------------------------------\n\n"); printf("\t\t\t\t%s\n",xm[i]); printf("\n"); printf("\t\t\t\t數(shù)學(xué):"); scanf("%d",&shuxue[i]); printf("\n"); getchar(); printf("\t\t\t\t英語(yǔ):"); scanf("%d",&yingyu[i]); printf("\n"); getchar(); printf("\t\t\t\tc語(yǔ)言:"); scanf("%d",&c[i]); system("cls"); } } void alter() { int i;/*循環(huán)變量*/ int m[10000];/*要查詢(xún)的學(xué)號(hào)*/ int b;/*修改后的成績(jī)*/ char kemu[20]=""; printf("請(qǐng)輸入你要修改的學(xué)生的學(xué)號(hào)"); scanf("%d",&m); for (i=0;i<p;i++) { if (m==xuehao[i]) { printf("%s的數(shù)學(xué)成績(jī)?yōu)?d,英語(yǔ)成績(jī)?yōu)?d,c語(yǔ)言成績(jī)?yōu)?d,xm[i],shuxue[i],yingyu[i],c[i]"); printf("請(qǐng)輸入你想修改的科目");} } gets(kemu); getchar(); if (kemu=="數(shù)學(xué)"); { scanf("%d",&b); shuxue[i]=b;} if (kemu=="英語(yǔ)"); { scanf("%d",&b); yingyu[i]=b;} if (kemu=="c語(yǔ)言"); { scanf("%d",&b); c[i]=b; } printf("%s的數(shù)學(xué)成績(jī)?yōu)?d,英語(yǔ)成績(jī)?yōu)?d,c語(yǔ)言成績(jī)?yōu)?d,xm[i],shuxue[i],yingyu[i],c[i]"); } void scbybannji() { int i; char zyname[20]; int bjnumber; printf("請(qǐng)輸入你的專(zhuān)業(yè)名稱(chēng)"); scanf("%s",&zyname); printf("請(qǐng)輸入你的班級(jí)號(hào)"); scanf("%d",&bjnumber); for (i=0;i<p;i++) { if (zyname==y[i]); if (bjnumber==z[i]); printf("專(zhuān)業(yè)名稱(chēng)%s班級(jí)號(hào)%d數(shù)學(xué)成績(jī)%d英語(yǔ)成績(jī)%dc語(yǔ)言成績(jī)%d,y[i],z[i],shuxue[i],yingyu[i],c[i]"); } }
標(biāo)簽: c語(yǔ)言
上傳時(shí)間: 2018-06-08
上傳用戶(hù):2369043090
%球體 close all; G=6.67e-11; R=2;%球體半徑 p=4.0;%密度 D=10.0;%深度 M=(4/3)*pi*R^3*p;%質(zhì)量 x=-20:1:20; g=G*M*D./((x.^2+D^2).^(3/2)); Vxz=-3*G*M*D.*x./((x.^2+D^2).^(5/2)); Vzz=G*M.*(2*D^2-x.^2)./((x.^2+D^2).^(5/2)); Vzzz=3*G*M.*(2*D^2-3.*x.^2)./((x.^2+D^2).^(7/2)); subplot(2,2,1) plot(x,g,'k-'); xlabel('水平距離(m)'); ylabel('重力異常值'); title('球體重力異常Δg'); grid on subplot(2,2,2) plot(x,Vxz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vxz'); grid on subplot(2,2,3) plot(x,Vzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzz'); grid on subplot(2,2,4); plot(x,Vzzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzzz'); grid on %% %水平圓柱體 close all G=6.67e-11; p=10.0;%線(xiàn)密度 D=100.0;%深度 x=-200:1:200; g=G*2*p*D./(x.^2+D^2); Vxz=4*G*p*D.*x./(x.^2+D^2).^2; Vzz=2*G*p.*(D^2-x.^2)./(x.^2+D^2).^2; Vzzz=4*G*p.*(D^2-3.*x.^2)./((x.^2+D^2).^3); subplot(2,2,1) plot(x,g,'k-'); xlabel('水平距離(m)'); ylabel('重力異常值'); title('水平圓柱體重力異常Δg'); grid on subplot(2,2,2) plot(x,Vxz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vxz'); grid on subplot(2,2,3) plot(x,Vzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzz'); grid on subplot(2,2,4); plot(x,Vzzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzzz'); grid on %% %垂直臺(tái)階 G=6.67e-11; p=4.0;%密度 h1=50.0;%下層深度 h2=40.0;%上層深度 x=-100:1:100; g=G*p.*(pi*(h1-h2)+x.*log((x.^2+h1^2)./(x.^2+h2^2))+2*h1.*atan(x./h1)-2*h2.*atan(x./h2)); Vxz=G*p.*log((h1^2+x.^2)./(h2^2+x.^2)); Vzz=2*G*p.*atan((x.*(h1-h2))./(x.^2+h1*h2)); Vzzz=2*G*p.*x*(h1^2-h2^2)./((h1^2+x.^2).*(x.^2+h2^2)); subplot(2,2,1) plot(x,g,'k-'); xlabel('水平距離(m)'); ylabel('重力異常值'); title('垂直臺(tái)階重力異常Δg'); grid on subplot(2,2,2) plot(x,Vxz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vxz'); grid on subplot(2,2,3) plot(x,Vzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzz'); grid on subplot(2,2,4); plot(x,Vzzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzzz'); grid on %% %傾斜臺(tái)階 G=6.67e-11; p=4.0;%密度 h1=50.0;%下層深度 h2=40.0;%上層深度 a=pi/6;%傾斜角度 x=-500:1:500; g=G*p.*(pi*(h1-h2)+2*h1.*atan((x+h1*cot(a))./h1)-2*h2.*atan((x+h2*cot(a))./h1)+x.*sin(a)^2.*log(((h1+x.*sin(a).*cos(a)).^2+x.^2.*sin(a)^4)./((h2+x.*(sin(a)*cos(a))).^2+x.^2.*sin(a)^4))); Vxz=G*p.*(sin(a)^2.*log(((h1*cot(a)+x).^2+h1^2)./((h2*cot(a)+x).^2+h2^2))-2*sin(2*a).*(atan((h1/sin(a)+x.*cos(a))./(x.*sin(a)))-atan((h2/sin(a)+x.^cos(a))./(sin(a).*x)))); Vzz=G*p.*(0.5*sin(2*a)^2.*log(((h1*cot(a)+x).^2+h1^2)./((h2*cot(a)+x).^2+h2^2))+2*sin(a)^2.*(atan((h1/sin(a)+x.*cos(a))./(x.*sin(a)))-atan((h2/sin(a)+x.*cos(a))./(x.*sin(a))))); Vzzz=2*G*p*sin(a)^2.*((x+2*h2*cot(a))./((h2*cot(a)+x).^2+h2^2)-(x+2*h1*cot(a))./((h1*cot(a)+x).^2+h1^2)); subplot(2,2,1) plot(x,g,'k-'); xlabel('水平距離(m)'); ylabel('重力異常值'); title('傾斜臺(tái)階重力異常Δg'); grid on subplot(2,2,2) plot(x,Vxz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vxz'); grid on subplot(2,2,3) plot(x,Vzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzz'); grid on subplot(2,2,4); plot(x,Vzzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzzz'); grid on %% %鉛錘柱體 G=6.67e-11; p=4.0;%密度 h1=50.0;%下層深度 h2=40.0;%上層深度 a=3;%半徑 x=-500:1:500; g=G*p.*((x+a).*log(((x+a).^2+h1^2)./((x+a).^2+h2^2))-(x-a).*log(((x-a).^2+h1^2)./((x-a).^2+h2^2))+2*h1.*(atan((x+a)./h1)-atan((x-a)./h1))-2*h2.*(atan((x+a)./h2)-atan((x-a)./h2))); Vxz=G*p.*log((((x+a).^2+h1^2).*((x-a).^2+h2^2))./(((x+a).^2+h2^2).*((x-a).^2+h1^2))); Vzz=2*G*p.*(atan(h1./(x+a))-atan(h2./(x+a))-atan(h1./(x-a))+atan(h2./(x-a))); Vzzz=2*G*p.*((x+a)./((x+a).^2+h2^2)-(x+a)./((x+a).^2+h1^2)-(x-a)./((x-a).^2+h2^2)+(x-a)./((x-a).^2+h1^2)); subplot(2,2,1) plot(x,g,'k-'); xlabel('水平距離/m') ylabel('重力異常值') title('鉛垂柱體重力異常') grid on subplot(2,2,2) plot(x,Vxz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vxz'); grid on subplot(2,2,3) plot(x,Vzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzz'); grid on subplot(2,2,4); plot(x,Vzzz); xlabel('水平距離(m)'); ylabel('導(dǎo)數(shù)值'); title('Vzzz'); grid on
上傳時(shí)間: 2019-05-10
上傳用戶(hù):xiajiang
程控可編程線(xiàn)性電源廣泛應(yīng)用于集成電路測(cè)試和各種實(shí)驗(yàn)過(guò)程中,電源的性能、可靠性和易操作性是其關(guān)鍵指標(biāo)。本文以ATmega128單片機(jī)為控制核心,以ADS8341模數(shù)轉(zhuǎn)換器、 AD5624數(shù)模轉(zhuǎn)換器,設(shè)計(jì)了一款三通道輸出的程控可編程線(xiàn)性電源樣機(jī)。闡述該電源的系統(tǒng)架構(gòu)、結(jié)構(gòu)、操作系統(tǒng)、液晶顯示界面以及通信協(xié)議等設(shè)計(jì)內(nèi)容。對(duì)樣機(jī)進(jìn)行了測(cè)試,給出了該電源的常用指標(biāo),該樣機(jī)已長(zhǎng)時(shí)間應(yīng)用于高速高精度A/D轉(zhuǎn)換器和D/A轉(zhuǎn)換器的測(cè)試中。
標(biāo)簽: avr 單片機(jī) 可編程線(xiàn)性電源
上傳時(shí)間: 2022-03-28
上傳用戶(hù):canderile
FOC的控制核心——坐標(biāo)變換■坐標(biāo)系口一定子坐標(biāo)系(靜止)一A-B-C坐標(biāo)系(三相定子繞組、相差120度)一a-β坐標(biāo)系(直角坐標(biāo)系:a軸與A軸重合、β軸超前a軸90度)口一轉(zhuǎn)子坐標(biāo)系(旋轉(zhuǎn))-d-q坐標(biāo)系(d軸一轉(zhuǎn)子磁極的軸線(xiàn)、q軸超前d軸90度)口一定向坐標(biāo)系(旋轉(zhuǎn))M-T坐標(biāo)系(M軸固定在定向的磁鏈?zhǔn)噶可希琓軸超前M軸90度)轉(zhuǎn)子磁場(chǎng)定向控制一-M-T坐標(biāo)系與d-q坐標(biāo)系重合FOC的控制核心——SVPWM■空間矢量口根據(jù)功率管的開(kāi)關(guān)狀態(tài)(上管導(dǎo)通是“1",關(guān)閉是“0")定義了8個(gè)空間矢量。其中000和111是零矢量。■扇區(qū)口空間矢量構(gòu)成6個(gè)扇區(qū)口確定Vref位于哪個(gè)扇區(qū),才能知道用哪對(duì)相鄰的基本電壓空間矢量去合成Vref。■參考電壓矢量合成口利用基本電壓空間矢量的線(xiàn)性時(shí)間組合得到定子參考電壓Vref。■七段式SVPWM,由3段零矢量和4段相鄰的兩個(gè)非零矢量組成。3段零矢量分別位于PWM的開(kāi)始、中間和結(jié)尾。■非零電壓空間矢量能使電機(jī)磁通空間矢量產(chǎn)生運(yùn)動(dòng),而零電壓空間矢量使磁通空間矢量靜止
標(biāo)簽: foc
上傳時(shí)間: 2022-06-30
上傳用戶(hù):qdxqdxqdxqdx
dsp hư ớ ng dẫ n giao tiế p LCD code viế t bằ ng C
上傳時(shí)間: 2017-06-17
上傳用戶(hù):xuanjie
hư ớ ng dẫ n về dsp tham khả o các cô ng cụ cơ bả n
上傳時(shí)間: 2014-12-01
上傳用戶(hù):zhichenglu
learningMatlab PhÇ n 1 c¬ së Mat lab Ch ¬ ng 1: Cµ i ® Æ t matlab 1.1.Cµ i ® Æ t ch ¬ ng tr×nh: Qui tr×nh cµ i ® Æ t Matlab còng t ¬ ng tù nh viÖ c cµ i ® Æ t c¸ c ch ¬ ng tr×nh phÇ n mÒ m kh¸ c, chØ cÇ n theo c¸ c h íng dÉ n vµ bæ xung thª m c¸ c th« ng sè cho phï hî p. 1.1.1 Khë i ® éng windows. 1.1.2 Do ch ¬ ng tr×nh ® î c cÊ u h×nh theo Autorun nª n khi g¾ n dÜ a CD vµ o æ ® Ü a th× ch ¬ ng tr×nh tù ho¹ t ® éng, cö a sæ
標(biāo)簽: learningMatlab 172 199 173
上傳時(shí)間: 2013-12-20
上傳用戶(hù):lanwei
metricmatlab ch ¬ ng 4 Ma trË n - c¸ c phÐ p to¸ n vÒ ma trË n. 4.1 Kh¸ i niÖ m: - Trong MATLAB d÷ liÖ u ® Ó ® a vµ o xö lý d íi d¹ ng ma trË n. - Ma trË n A cã n hµ ng, m cét ® î c gä i lµ ma trË n cì n m. § î c ký hiÖ u An m - PhÇ n tö aij cñ a ma trË n An m lµ phÇ n tö n» m ë hµ ng thø i, cét j . - Ma trË n ® ¬ n ( sè ® ¬ n lÎ ) lµ ma trË n 1 hµ ng 1 cét. - Ma trË n hµ ng ( 1 m ) sè liÖ u ® î c bè trÝ trª n mét hµ ng. a11 a12 a13 ... a1m - Ma trË n cét ( n 1) sè liÖ u ® î c bè trÝ trª n 1 cét.
標(biāo)簽: metricmatlab 203 184 tr
上傳時(shí)間: 2017-07-29
上傳用戶(hù):來(lái)茴
D-sub-jy
標(biāo)簽: D-sub-jy
上傳時(shí)間: 2013-04-15
上傳用戶(hù):eeworm
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1