# include < reg52.h > # include < 24C02.h> # define uint unsigned int # define uchar unsigned char sbit rs = P3^5; //定義lcd1602的rs端 sbit lcden = P3^4;//定義lcd1602的lcden端口 sbit s1 = P3^0;//定義功能鍵s1 sbit s2 = P3^1;//定義功能鍵s2 sbit s3 = P3^2;//定義功能鍵s3 sbit beep = P2^3;//定義蜂鳴器 uchar count, s1num; char miao,fen,shi; uchar code table[] = "Designer:X_ZL ";//定義初始上電時液晶默認顯示狀態 void delay_ms( xms ) //定義延時函數 { uint i,j; for( i = xms ; i > 0 ; i --) for( j = 110 ; j > 0 ; j --); }
上傳時間: 2016-07-28
上傳用戶:游戲好嗎
void DFS(MGraph G, int i) { int j; visited[i] = TRUE; printf("%c ", G.vexs[i]); for (j=0; j<G.numVertexes; ++j) { if (G.arc[i][j]!=INFINITY && !visited[j]) DFS(G, j); } }
上傳時間: 2016-12-28
上傳用戶:chenyameng
#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; 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輸入運動項目序號 (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; printf("Input name:) : "); scanf("%s",pfirst->athlete[pfirst->count].name); } printf("\n繼續輸入運動項目(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號學校的結果成績:",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按任意建 進入下一頁"); getchar(); 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按任意建結束"); 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("文件已經成功保存\n"); } void 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 = (int *)calloc(ntsp,sizeof(int)); pafirst = phead; pasecond = phead; input(); calculate(); output(); Save(); }
標簽: 源代碼
上傳時間: 2016-12-28
上傳用戶:150501
/*import java.util.Scanner; //主類 public class student122 { //主方法 public static void main(String[] args){ //定義7個元素的字符數組 String[] st = new String[7]; inputSt(st); //調用輸入方法 calculateSt(st); //調用計算方法 outputSt(st); //調用輸出方法 } //其他方法 //輸入方法 private static void inputSt(String st[]){ System.out.println("輸入學生的信息:"); System.out.println("學號 姓名 成績1,2,3"); //創建鍵盤輸入類 Scanner ss = new Scanner(System.in); for(int i=0; i<5; i++){ st[i] = ss.next(); //鍵盤輸入1個字符串 } } //計算方法 private static void calculateSt(String[] st){ int sum = 0; //總分賦初值 int ave = 0; //平均分賦初值 for(int i=2;i<5;i++) { /計總分,字符變換成整數后進行計算 sum += Integer.parseInt(st[i]); } ave = sum/3; //計算平均分 //整數變換成字符后保存到數組里 st[5] = String.valueOf(sum); st[6] = String.valueOf(ave); } //輸出方法 private static void outputSt(String[] st){ System.out.print("學號 姓名 "); //不換行 System.out.print("成績1 成績2 成績3 "); System.out.println("總分 平均分");//換行 //輸出學生信息 for(int i=0; i<7; i++){ //按格式輸出,小于6個字符,補充空格 System.out.printf("%6s", st[i]); } System.out.println(); //輸出換行 } }*/ import java.util.Scanner; public class student122 { public static void main(String[] args) { // TODO 自動生成的方法存根 String[][] st = new String[3][8]; inputSt(st); calculateSt(st); outputSt(st); } //輸入方法 private static void inputSt(String st[][]) { System.out.println("輸入學生信息:"); System.out.println("班級 學號 姓名 成績:數學 物理 化學"); //創建鍵盤輸入類 Scanner ss = new Scanner(System.in); for(int j = 0; j < 3; j++) { for(int i = 0; i < 6; i++) { st[j][i] = ss.next(); } } } //輸出方法 private static void outputSt(String st[][]) { System.out.println("序號 班級 學號 姓名 成績:數學 物理 化學 總分 平均分"); //輸出學生信息 for(int j = 0; j < 3; j++) { System.out.print(j+1 + ":"); for(int i = 0; i < 8; i++) { System.out.printf("%6s", st[j][i]); } System.out.println(); } } //計算方法 private static void calculateSt(String[][] st) { int sum1 = 0; int sum2 = 0; int sum3 = 0; int ave1 = 0; int ave2 = 0; int ave3 = 0; for(int i = 3; i < 6; i++) { sum1 += Integer.parseInt(st[0][i]); } ave1 = sum1/3; for(int i = 3; i < 6; i++) { sum2 += Integer.parseInt(st[1][i]); } ave2 = sum2/3; for(int i = 3; i < 6; i++) { sum3 += Integer.parseInt(st[2][i]); } ave3 = sum3/3; st[0][6] = String.valueOf(sum1); st[1][6] = String.valueOf(sum2); st[2][6] = String.valueOf(sum3); st[0][7] = String.valueOf(ave1); st[1][7] = String.valueOf(ave2); st[2][7] = String.valueOf(ave3); } }
上傳時間: 2017-03-17
上傳用戶:simple
問題描述:以一個m*n的長方陣表示迷宮,0和1分別表示迷宮中的通路和障礙。設計一個程序,對任意設定的迷宮,求出一條從入口到出口的通路,或得出沒有通路的結論。 1.基本要求 (1)首先實現一個以鏈表作存儲結構的棧類型,然后編寫一個求解迷宮的非遞歸程序。求得的通路以三元組(i,j,d)的形式輸出。其中:(i,j)指示迷宮中的一個坐標,d表示走到下一坐標的方向。如下圖所示迷宮。從入口(1,1)到出口(8,8)的求解結果如下: (1,1)(1,2),(2,2)(3,2)(3,1)(4,1)(5,1)(5,2)(5,3)(6,3)(6,4)(6,5)(5,5)(4,5)(4,6)(4,7)(3,7)(3,8)(4,8)(5,8)(6,8)(7,8)(8,8) (2)以方陣形式輸出迷宮及其通路。 2.重點、難點 重點:針對迷宮問題的特點,利用棧的后進先出特點,選擇適當的數據結構。 難點:遞歸算法的設計與求解。
標簽: 迷宮
上傳時間: 2018-07-03
上傳用戶:MOOMWHITE
function [R,k,b] = msc(A) % 多元散射校正 % 輸入待處理矩陣,通過多元散射校正,求得校正后的矩陣 %% 獲得矩陣行列數 [m,n] = size(A); %% 求平均光譜 M = mean(A,2); %% 利用最小二乘法求每一列的斜率k和截距b for i = 1:n a = polyfit(M,A(:,i),1); if i == 1 k = a(1); b = a(2); else k = [k,a(1)]; b = [b,a(2)]; end end %% 求得結果 for i = 1:n Ai = (A(:,i)-b(i))/k(i); if i == 1 R = Ai; else R = [R,Ai]; end end
上傳時間: 2020-03-12
上傳用戶:15275387185
P P I I CK I I T T3 3 使用 說明--- - 連機 、 脫 機操作試用 MPLAB IDE 軟件一 、 P P I I C CK K I I T3 接 口說 明, , 硬 件 二 、 P P I I C CK K I I T3 連 接 電腦 MPL L AB I I DE 聯機三 、 聯機四 、聯機讀芯片程序五 、 脫機 燒寫 調試
上傳時間: 2022-03-24
上傳用戶:
本源代碼是基于STM32F4xx硬件平臺設計的貪吃蛇小游戲,主要難點在:隨機點產生、貪吃蛇轉向、貪吃蛇貪吃點;本部分主要接收產生隨機點,產生隨機點需要注意兩個方面:1、隨機點在有效的范圍內;2、貪吃點與貪吃蛇不重合。產生隨機點主要有兩個函數,分別如下://隨機數產生任務void rng_chansheng(void *p_arg){OS_ERR err;while(1){OSSemPend(&RNG_SEM,0,OS_OPT_PEND_BLOCKING,0,&err);zou.x = RNG_Get_RandomRange(0,50)*8 + 40;zou.y = RNG_Get_RandomRange(0,50)*8 + 260;lcd_fangkuan(zou.x,zou.y,zou.x+SHE_FAANGKUAN_SIZE,zou.y+SHE_FAANGKUAN_SIZE);OSTimeDlyHMSM(0,0,0,500,OS_OPT_TIME_HMSM_STRICT,&err); //延時500ms}}//往下方向畫一個實心的正方形,代表貪食蛇的一段void lcd_fangkuan(u16 x1,u16 y1,u16 x2 ,u16 y2){u16 i,j;u16 xx,yy;if(((x2 - x1) != SHE_FAANGKUAN_SIZE)||((y2 - y1) != SHE_FAANGKUAN_SIZE))return ;if(x1 > x2) {xx = x1;x1 = x2;x2 = xx;}if(y1 > y2){yy = y1;y1 = y2;y2 = yy;}if((y1 < 260)|| (y2 > 660)||(x1 < 40)||(x2 > 448)){game_yun_error = 1;LCD_ShowString(150,300,500,24,24,"GAME OVER!!");return ;}for(i=x1; i<x2; i++){for(j=y1; j<y2; j++){LCD_DrawPoint(i,j);}}}
上傳時間: 2022-08-10
上傳用戶:
VIP專區-嵌入式/單片機編程源碼精選合集系列(58)資源包含以下內容:1. veriloghdl語言工具書.2. 嵌入式詞典查詢.3. 基于ZigBee的無線網絡技術.4. IO 口模擬232通訊程序使用兩種方式的C程序.5. 用Turbo C 實現動畫的一個簡單的實現方法 這種簡單方法利用cleardevice()和delay()函數相互配合.6. dsp2812系列開發辦的原理圖.7. 此程序為網絡通信的16位校驗累加和的經典程序。雖然簡單但是很經典。代碼簡潔.8. 觸摸式人行燈控制器原理圖 觸摸式人行燈控制器原理圖.9. 3310LCD的C51驅動程序,還不錯哦.10. 一些常用的LCD的C51驅動程序,還不錯哦.11. NXP示例編碼集,Software that is described herein is for illustrative purposes only which provides custom.12. W78E516B在系統編程的上位機程序.13. 使用TI TMS2407 實現SVPWM同步電機控制算法。源代碼在聞廷科技的2407開發板上已經調試成功。.14. Nucleus Kernel Demo Full source code.15. Altera CPLD矩陣鍵盤一個很不錯的Altera芯片程序.16. 基于Nios II的串口通信.17. The combined demo is dedicated for S1C33L05, so DMT33L05 should be used to load and run the demo. F.18. 用CPLD驅動SJA1000 CAN控制器.19. arm uart program lpc2104.20. 嵌入式PLC,基于8051F020,在KEIL上開發,可實現自定義PLC功能.21. SMDK2410原理圖protel格式和PCB庫元件.22. 功能:調用IAP服務程序實現Flash ROM的讀/寫操作向Flash ROM地址1000H處寫入10個數據.23. 功能:由KEY1鍵使系統進入空閑狀態.24. WDT功能試驗。使用WDT的定時模塊.25. 功能:使用CCU的4個模塊.26. s3c2440開發板can控制器sja1000驅動.27. 一個3分頻器。可進一步改裝成實際需要的分頻器使用.28. 通過軟件的仿真,硬件的調試,實現串口數據的傳輸,開發環境包括C-C++與匯編語言..29. ICD2原理圖(protel格式、帶usb接口和串口).30. 免費分享版網路硬碟 01.創意風格首頁 02.申請會員 03.密碼查詢 04.會員容量限制 05.上傳檔案支援  Persits.Upload Dundas.Upload Lyf.31. 是一個ARM214系連的最小系統原理圖,希望能多愛好嵌入是開發的人員有幫助.32. ds1621的c51驅動,帶12864液晶驅動..33. ds1302時鐘代碼.34. LCD顯示屏驅動sed1335驅動.35. 漢字顯示字庫及程序源碼14*16標準字庫.36. 14*16字庫生成器升級版.37. This utility downloads code to Philip LPC 2000 series chips.38. 測試ARM的外圍SDAM的狀態和參數.39. 三星44B0上的MP3源碼.40. CPLD 的程序,分頻器.
上傳時間: 2013-07-23
上傳用戶:eeworm
替代加密: A B C D E F G H I J K L M N O P Q R S T U V W 密文 Y Z D M R N H X J L I O Q U W A C B E G F K P 明文 X Y Z T S V I HAVE A DREAM!# 密文?? 用ARM編程實現替代加密。
標簽: 加密
上傳時間: 2016-07-17
上傳用戶:qq521