亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

switch-case

  • 運(yùn)動會源代碼

    #include <malloc.h>       #include <stdio.h>       #include <stdlib.h>       #include <string.h>       #define NULL 0      #define MaxSize 30          typedef struct athletestruct /*運(yùn)動員*/     {         char name[20];          int score; /*分?jǐn)?shù)*/         int range; /**/         int item; /*項(xiàng)目*/     }ATH;     typedef struct schoolstruct /*學(xué)校*/     {         int count; /*編號*/         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)動項(xiàng)目序號 (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)存在請選擇其他的數(shù)字\n");                     goto Is_Game_DoMain;                 }             }         }         pafirst = pafirst + 1;         if ( overgame > ntsp )         {             printf("\n項(xiàng)目不存在");             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超過學(xué)校數(shù)目,請重新輸入");             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)動項(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號學(xué)校的結(jié)果成績:",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)入下一頁");             getchar();             pfirst = pfirst->next;         }     //  clrscr();          printf("\n運(yùn)動會結(jié)果:\n\n學(xué)校編號\t男運(yùn)動員成績\t女運(yùn)動員成績\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)動會分?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

    上傳用戶:150501

  • c#簡單計(jì)算器

    // 學(xué)生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person {   char name[10];   int ID;   int cj_yw;   int cj_sx;   struct person* next;   struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance,                      HINSTANCE hPrevInstance,                      LPSTR     lpCmdLine,                      int       nCmdShow) {   // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow))  { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0))  { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))  { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // //  FUNCTION: MyRegisterClass() // //  PURPOSE: Registers the window class. // //  COMMENTS: // //    This function and its usage is only necessary if you want this code //    to be compatible with Win32 systems prior to the 'RegisterClassEx' //    function that was added to Windows 95. It is important to call this function //    so that the application will get 'well formed' small icons associated //    with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX);  wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // //   FUNCTION: InitInstance(HANDLE, int) // //   PURPOSE: Saves instance handle and creates main window // //   COMMENTS: // //        In this function, we save the instance handle in a global variable and //        create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {    HWND hWnd;    hInst = hInstance; // Store instance handle in our global variable    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);    if (!hWnd)    {       return FALSE;    }    ShowWindow(hWnd, nCmdShow);    UpdateWindow(hWnd);    return TRUE; } // //  FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // //  PURPOSE:  Processes messages for the main window. // //  WM_COMMAND - process the application menu //  WM_PAINT - Paint the main window //  WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message)  { case WM_COMMAND: wmId    = LOWORD(wParam);  wmEvent = HIWORD(wParam);  // Parse the menu selections: switch (wmId) { case IDM_ABOUT:   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);   break; case IDM_EXIT:   DestroyWindow(hWnd);   break; default:   return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam);    }    return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)  { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; }     return FALSE; }

    標(biāo)簽: 計(jì)算器 學(xué)生

    上傳時(shí)間: 2016-12-29

    上傳用戶:767483511

  • 簡單的計(jì)算器

    // 學(xué)生管理.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "resource.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst; // current instance TCHAR szTitle[MAX_LOADSTRING]; // The title bar text TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text // Foward declarations of functions included in this code module: ATOM MyRegisterClass(HINSTANCE hInstance); BOOL InitInstance(HINSTANCE, int); LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); struct person {   char name[10];   int ID;   int cj_yw;   int cj_sx;   struct person* next;   struct person* pro; }per; int APIENTRY WinMain(HINSTANCE hInstance,                      HINSTANCE hPrevInstance,                      LPSTR     lpCmdLine,                      int       nCmdShow) {   // TODO: Place code here. MSG msg; HACCEL hAccelTable; // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_MY, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow))  { return FALSE; } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_MY); // Main message loop: while (GetMessage(&msg, NULL, 0, 0))  { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))  { TranslateMessage(&msg); DispatchMessage(&msg); } } return msg.wParam; } // //  FUNCTION: MyRegisterClass() // //  PURPOSE: Registers the window class. // //  COMMENTS: // //    This function and its usage is only necessary if you want this code //    to be compatible with Win32 systems prior to the 'RegisterClassEx' //    function that was added to Windows 95. It is important to call this function //    so that the application will get 'well formed' small icons associated //    with it. // ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEX wcex; wcex.cbSize = sizeof(WNDCLASSEX);  wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_MY); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_MY; wcex.lpszClassName = szWindowClass; wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); return RegisterClassEx(&wcex); } // //   FUNCTION: InitInstance(HANDLE, int) // //   PURPOSE: Saves instance handle and creates main window // //   COMMENTS: // //        In this function, we save the instance handle in a global variable and //        create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {    HWND hWnd;    hInst = hInstance; // Store instance handle in our global variable    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);    if (!hWnd)    {       return FALSE;    }    ShowWindow(hWnd, nCmdShow);    UpdateWindow(hWnd);    return TRUE; } // //  FUNCTION: WndProc(HWND, unsigned, WORD, LONG) // //  PURPOSE:  Processes messages for the main window. // //  WM_COMMAND - process the application menu //  WM_PAINT - Paint the main window //  WM_DESTROY - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent; PAINTSTRUCT ps; HDC hdc; TCHAR szHello[MAX_LOADSTRING]; LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING); switch (message)  { case WM_COMMAND: wmId    = LOWORD(wParam);  wmEvent = HIWORD(wParam);  // Parse the menu selections: switch (wmId) { case IDM_ABOUT:   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);   break; case IDM_EXIT:   DestroyWindow(hWnd);   break; default:   return DefWindowProc(hWnd, message, wParam, lParam); } break; case WM_PAINT: hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam);    }    return 0; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)  { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; }     return FALSE; }

    標(biāo)簽: 學(xué)生 計(jì)算器

    上傳時(shí)間: 2016-12-29

    上傳用戶:767483511

  • QCA8228 Switch chip HDK

    QCA8228 Switch chip HDK

    標(biāo)簽: Switch 8228 chip QCA HDK

    上傳時(shí)間: 2017-10-25

    上傳用戶:atherospaopao

  • 學(xué)生成績管理

    #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專業(yè) z班級*/  int z[100];  main() { void input(); void inputsc(); void alter(); void scbybannji(); printf("--------學(xué)生成績管理-----\n"); printf("請按相應(yīng)數(shù)字鍵來實(shí)現(xiàn)相應(yīng)功能\n"); printf("1.錄入學(xué)生信息   2.錄入學(xué)生成績       3.修改學(xué)生成績\n"); printf("4.查詢學(xué)生成績   5.不及格科目及名單   6.按班級輸出學(xué)生成績單\n"); printf("請輸入你要實(shí)現(xiàn)的功能所對應(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("請輸入你的學(xué)院名稱:"); gets(x); printf("請輸入你的專業(yè)名稱:"); gets(y); printf("請輸入你的班級號:"); scanf("%d",&z); printf("請輸入你們一個(gè)班有幾個(gè)人:"); scanf("%d",&p); system("cls"); for(i=0;i<p;i++) { printf("請輸入第%d個(gè)學(xué)生的學(xué)號:",i+1); scanf("%d",xuehao[i]); getchar(); printf("請輸入第%d個(gè)學(xué)生的姓名:",i+1); gets(xm[i]); system("cls"); } printf("您已經(jīng)錄入完畢您的班級所有學(xué)生的信息!\n"); printf("您的班級為%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é)生的成績\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英語:"); scanf("%d",&yingyu[i]); printf("\n"); getchar(); printf("\t\t\t\tc語言:"); scanf("%d",&c[i]); system("cls"); } } void alter() { int i;/*循環(huán)變量*/ int m[10000];/*要查詢的學(xué)號*/ int b;/*修改后的成績*/ char kemu[20]=""; printf("請輸入你要修改的學(xué)生的學(xué)號"); scanf("%d",&m); for (i=0;i<p;i++) { if (m==xuehao[i]) { printf("%s的數(shù)學(xué)成績?yōu)?d,英語成績?yōu)?d,c語言成績?yōu)?d,xm[i],shuxue[i],yingyu[i],c[i]");  printf("請輸入你想修改的科目");} } gets(kemu); getchar(); if (kemu=="數(shù)學(xué)"); { scanf("%d",&b); shuxue[i]=b;} if (kemu=="英語"); { scanf("%d",&b); yingyu[i]=b;} if (kemu=="c語言"); { scanf("%d",&b); c[i]=b; } printf("%s的數(shù)學(xué)成績?yōu)?d,英語成績?yōu)?d,c語言成績?yōu)?d,xm[i],shuxue[i],yingyu[i],c[i]"); } void scbybannji() { int i; char zyname[20]; int bjnumber; printf("請輸入你的專業(yè)名稱"); scanf("%s",&zyname); printf("請輸入你的班級號"); scanf("%d",&bjnumber); for (i=0;i<p;i++) { if (zyname==y[i]); if (bjnumber==z[i]); printf("專業(yè)名稱%s班級號%d數(shù)學(xué)成績%d英語成績%dc語言成績%d,y[i],z[i],shuxue[i],yingyu[i],c[i]"); } }

    標(biāo)簽: c語言

    上傳時(shí)間: 2018-06-08

    上傳用戶:2369043090

  • Dual USB High-Side Power Switch

    The SP2526A device is a dual +3.0V to +5.5V USB Supervisory Power Control Switch ideal for self-powered and bus-powered Universal Serial Bus (USB) applications. Each switch has low on-resistance (110mΩ typical) and can supply 500mA minimum. The fault currents are limited to 1.0A typical and the flag output pin for each switch is available to indicate fault conditions to the USB controller. The thermal shutdown feature will prevent damage to the device when subjected to excessive current loads. The undervoltage lockout feature will ensure that the device will remain off unless there is a valid input voltage present.

    標(biāo)簽: High-Side Switch Power Dual USB

    上傳時(shí)間: 2019-03-06

    上傳用戶:bhitr

  • BTS50_datasheet

    The BTS5016SDA is a one channel high-side power switch in PG-TO252-5-11 package providing embedded protective functions. The power transistor is built by a N-channel vertical power MOSFET with charge pump. The design is based on Smart SIPMOS chip on chip technology. The BTS5016SDA has a current controlled input and offers a diagnostic feedback with load current sense and a defined fault signal in case of overload operation, overtemperature shutdown and/or short circuit shutdown.

    標(biāo)簽: datasheet BTS 50

    上傳時(shí)間: 2019-03-27

    上傳用戶:guaixiaolong

  • 成績查詢系統(tǒng)

    #include<stdio.h> #include<string.h> #include<stdlib.h> #define N 100 int iNumOfStu=0; struct score   {   float math;   float english;   float computer;   }; struct student   {   int number;   char name[20];   struct score sco;   float average;   }; struct student stu[N]; void print_menu(void);//輸出菜單 void choosemenu(void);//菜單選擇 void input_student1(int);//輸入學(xué)生信息 void input_student2(void);//輸入總函數(shù) void input_student3(int &,int);//判斷學(xué)號是否重復(fù) void input_student4(int,int);//覆蓋原信息 void sort_student3(student s[],int);//按照英語成績排序 void sort_student4(student s[],int);//按照計(jì)算機(jī)成績排序 void sort_student2(student s[],int);//按照數(shù)學(xué)成績排序 void sort_student5(student s[],int);//按照平均成績排序 float input_score2(int);//計(jì)算學(xué)生平均成績 void print_student2(void);//顯示表頭 void print_student3(int);//顯示學(xué)生信息 void print_student1(int);//顯示全部學(xué)生資料 void sort_student1(void);//排序總函數(shù) void menu(void);//菜單調(diào)度總函數(shù) int search_student2(int);//按學(xué)號查詢學(xué)生信息并輸出 void search_student3(int);//按平均分最高查詢并輸出 void search_student1(void);//查詢總函數(shù) void delete_student2(int,int);//刪除學(xué)生信息 void delete_student1(void);//刪除總函數(shù) void change_student2(int);//修改學(xué)生資料 void change_student1(void);//修改總函數(shù) void input_score3(int);//統(tǒng)計(jì)成績 void input_score1(void);//統(tǒng)計(jì)成績總函數(shù) void print_help(void);//輸出幫助信息 void exit_student(void);//退出系統(tǒng) void save_student(student *,int);//保存學(xué)生信息 void main()   {   menu();   } void save_student(student *s,int a)//保存學(xué)生信息   {   FILE *fp;     if((fp=fopen("d:\\學(xué)生信息.txt","wb"))==NULL)       {       printf("不能打開文件!\n");       }     else       {       printf("保存信息到D盤\n");       fprintf(fp,"本班所有學(xué)生具體信息如下:\r\n");       fprintf(fp,"  學(xué)號       姓名           數(shù)學(xué)成績       英語成績     計(jì)算機(jī)成績     平均成績\r\n");       for(int i=0;i<a;i++)         {         fprintf(fp,"%8d%12s%14.2f%14.2f%14.2f%14.2f\n",stu[i].number,stu[i].name,stu[i].sco.math,stu[i].sco.english,stu[i].sco.computer,stu[i].average);         fprintf(fp,"\r\n");         }       fclose(fp);       printf("信息保存成功!\n");       }   } void exit_student(void)//退出系統(tǒng)   {   exit(1);   } void print_help(void)//輸出幫助信息   {   printf("本系統(tǒng)所能容納的最大學(xué)生數(shù)為%d人\n學(xué)生信息保存在D盤根目錄下,保存文件為“學(xué)生信息.txt”。\n感謝使用!\n",N);   } void input_score1(void)//統(tǒng)計(jì)成績總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   printf("學(xué)號:%d\n",stu[c].number);   printf("姓名:%s\n",stu[c].name);   input_score3(c);   printf("新成績錄入成功!\n");   stu[c].average=input_score2(c);   } void input_score3(int a)//統(tǒng)計(jì)成績   {   printf("數(shù)學(xué)新成績:");   scanf("%f",&stu[a].sco.math);   printf("英語新成績:");   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)新成績:");   scanf("%f",&stu[a].sco.computer);   } void change_student2(int a)//修改學(xué)生資料   {   printf("學(xué)號:%d----修改為:",stu[a].number);   scanf("%d",&stu[a].number);   getchar();   printf("姓名:%s----修改為:",stu[a].name);   gets(stu[a].name);   printf("數(shù)學(xué)成績:%.2f----修改為:",stu[a].sco.math);   scanf("%f",&stu[a].sco.math);   printf("英語成績:%.2f----修改為:",stu[a].sco.english);   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)成績:%.2f----修改為:",stu[a].sco.computer);   scanf("%f",&stu[a].sco.computer);   } void change_student1(void)//修改總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   getchar();   printf("是否要修改此學(xué)生信息?(“y”代表是)");   char d;   scanf("%c",&d);   if(d=='y'||d=='Y')     {     change_student2(c);       stu[c].average=input_score2(c);     printf("信息修改成功!\n");     }   } void delete_student1(void)//刪除總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   getchar();   printf("是否刪除此條記錄?(“y”代表是)");   char d;   scanf("%c",&d);   if(d=='y'||d=='Y')     {     delete_student2(c,iNumOfStu);     printf("記錄已刪除!\n");     }   } void delete_student2(int a,int b)//刪除學(xué)生信息   {   for(int i=a;i<b-1;i++)     {     stu[i]=stu[i+1];     }   --iNumOfStu;   } void search_student1(void)//查詢總函數(shù)   {   printf("1、按學(xué)號查詢\n2、按平均分最高查詢\n請選擇:");   int c;   scanf("%d",&c);   switch(c)     {     case 1:       {       search_student2(iNumOfStu);       break;       }     case 2:       {       search_student3(iNumOfStu);       break;       }     default: break;     }   } void menu(void)//菜單調(diào)度總函數(shù)   {   print_menu();   choosemenu();   } void sort_student1(void)//排序總函數(shù)   {   printf("1、按數(shù)學(xué)成績排序\n2、按英語成績排序\n3、按計(jì)算機(jī)成績排序\n4、按平均成績排序\n請選擇:");   int c;   scanf("%d",&c);   switch(c)     {     case 1:       {       sort_student2(stu,iNumOfStu);       break;       }     case 2:       {       sort_student3(stu,iNumOfStu);       break;       }     case 3:       {       sort_student4(stu,iNumOfStu);       break;       }     case 4:       {       sort_student5(stu,iNumOfStu);       break;       }     default: break;     }   } void print_student1(int a)//顯示全部學(xué)生資料   {   printf("本班所有學(xué)生具體信息如下\n");   print_student2();   for(int i=0;i<a;i++)     {     print_student3(i);     }   } void print_student3(int a)//顯示學(xué)生信息   {   printf("%8d%12s%14.2f%14.2f%14.2f%14.2f\n",stu[a].number,stu[a].name,stu[a].sco.math,stu[a].sco.english,stu[a].sco.computer,stu[a].average);   } void print_student2(void)//顯示表頭   {   printf("  學(xué)號       姓名           數(shù)學(xué)成績       英語成績     計(jì)算機(jī)成績     平均成績\n");   } void input_student4(int a,int b)//覆蓋原信息   {   stu[a]=stu[b-1];   --iNumOfStu;   } void input_student3(int &a,int b)//判斷學(xué)號是否重復(fù)   {   if(a!=0)     {     int i=0;     do       {       if(stu[a].number==stu[i].number)         {         printf("此學(xué)號代表的學(xué)生已錄入\n1、覆蓋原信息\n2、重新輸入\n請選擇:");         int c;         scanf("%d",&c);         switch(c)           {           case 1:             {             input_student4(i,iNumOfStu);             a=iNumOfStu-1;             printf("信息已替換!\n");             break;             }           case 2:             {             printf("請重新輸入學(xué)生信息:\n");             input_student1(iNumOfStu-1);             break;             }           default: break;           }         break;         }       ++i;       }       while(i<b-1);     }   } void print_menu(void)//輸出菜單   {   printf("======歡迎來到學(xué)生信息管理系統(tǒng)======\n");   printf("      1、輸入學(xué)生資料\n");   printf("      2、刪除學(xué)生資料\n");   printf("      3、查詢學(xué)生資料\n");   printf("      4、修改學(xué)生資料\n");   printf("      5、顯示學(xué)生資料\n");   printf("      6、統(tǒng)計(jì)學(xué)生成績\n");   printf("      7、排序?qū)W生成績\n");   printf("      8、保存學(xué)生資料\n");   printf("      9、獲取幫助信息\n");   printf("      10、退出系統(tǒng)\n");   printf("====================================\n");   printf("請選擇:");   } void input_student2(void)//輸入總函數(shù)   {   char end;   printf("請輸入學(xué)生信息(在最后一個(gè)學(xué)生信息錄入完成后以“/”結(jié)束錄入):\n");   for(int i=0;(end=getchar())!='/';i++)     {     input_student1(i);     ++iNumOfStu;     input_student3(i,iNumOfStu);     }   for(int j=0;j<iNumOfStu;j++)     {     stu[j].average=input_score2(j);     }   } void input_student1(int a)//輸入學(xué)生信息   {   printf("學(xué)號:");   scanf("%d",&stu[a].number);   getchar();   printf("姓名:");   gets(stu[a].name);   printf("數(shù)學(xué)成績:");   scanf("%f",&stu[a].sco.math);   printf("英語成績:");   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)成績:");   scanf("%f",&stu[a].sco.computer);   } float input_score2(int a)//計(jì)算學(xué)生平均成績   {   return (stu[a].sco.math+stu[a].sco.english+stu[a].sco.computer)/3;   } void search_student3(int a)//按平均分最高查詢并輸出   {   int max=0;   for(int i=0;i<a;i++)     {     if(stu[max].average<stu[i].average)       {       max=i;       }     }   print_student2();   print_student3(max);   } void sort_student2(student s[],int a)//按照數(shù)學(xué)成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.math>stu[max].sco.math)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student3(student s[],int a)//按照英語成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.english>stu[max].sco.english)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student4(student s[],int a)//按照計(jì)算機(jī)成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.computer>stu[max].sco.computer)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student5(student s[],int a)//按照平均成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].average>stu[max].average)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } int search_student2(int a)//按照學(xué)號查找學(xué)生并輸出   {   int num;   int c;   printf("請輸入要查詢的學(xué)號:");   scanf("%d",&num);   for(int i=0;i<a;i++)     {     if(num==stu[i].number)       {       c=i;       }     }   printf("此學(xué)生的信息是:\n");   print_student2();   print_student3(c);   return c;   } void choosemenu(void)//菜單選擇   {   int i;   scanf("%d",&i);   switch(i)     {     case 1:       {       input_student2();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 2:       {       delete_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 3:       {       search_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 4:       {       change_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 5:       {       print_student1(iNumOfStu);       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 6:       {       input_score1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 7:       {       sort_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 8:       {       save_student(stu,iNumOfStu);       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 9:       {       print_help();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 10:       {       exit_student();       }     default: break;     }   }         運(yùn)行結(jié)果:                         源文件下載地址: http://115.com/file/clnq138g#一個(gè)簡單的學(xué)生成績管理系統(tǒng).rar (請將此地址復(fù)制到瀏覽器地址欄中訪問下載頁面)  

    標(biāo)簽: 成績查詢系統(tǒng)

    上傳時(shí)間: 2019-06-08

    上傳用戶:啊的撒旦

  • 學(xué)生成績guanli

    #include<stdio.h> #include<string.h> #include<stdlib.h> #define N 100 int iNumOfStu=0; struct score   {   float math;   float english;   float computer;   }; struct student   {   int number;   char name[20];   struct score sco;   float average;   }; struct student stu[N]; void print_menu(void);//輸出菜單 void choosemenu(void);//菜單選擇 void input_student1(int);//輸入學(xué)生信息 void input_student2(void);//輸入總函數(shù) void input_student3(int &,int);//判斷學(xué)號是否重復(fù) void input_student4(int,int);//覆蓋原信息 void sort_student3(student s[],int);//按照英語成績排序 void sort_student4(student s[],int);//按照計(jì)算機(jī)成績排序 void sort_student2(student s[],int);//按照數(shù)學(xué)成績排序 void sort_student5(student s[],int);//按照平均成績排序 float input_score2(int);//計(jì)算學(xué)生平均成績 void print_student2(void);//顯示表頭 void print_student3(int);//顯示學(xué)生信息 void print_student1(int);//顯示全部學(xué)生資料 void sort_student1(void);//排序總函數(shù) void menu(void);//菜單調(diào)度總函數(shù) int search_student2(int);//按學(xué)號查詢學(xué)生信息并輸出 void search_student3(int);//按平均分最高查詢并輸出 void search_student1(void);//查詢總函數(shù) void delete_student2(int,int);//刪除學(xué)生信息 void delete_student1(void);//刪除總函數(shù) void change_student2(int);//修改學(xué)生資料 void change_student1(void);//修改總函數(shù) void input_score3(int);//統(tǒng)計(jì)成績 void input_score1(void);//統(tǒng)計(jì)成績總函數(shù) void print_help(void);//輸出幫助信息 void exit_student(void);//退出系統(tǒng) void save_student(student *,int);//保存學(xué)生信息 void main()   {   menu();   } void save_student(student *s,int a)//保存學(xué)生信息   {   FILE *fp;     if((fp=fopen("d:\\學(xué)生信息.txt","wb"))==NULL)       {       printf("不能打開文件!\n");       }     else       {       printf("保存信息到D盤\n");       fprintf(fp,"本班所有學(xué)生具體信息如下:\r\n");       fprintf(fp,"  學(xué)號       姓名           數(shù)學(xué)成績       英語成績     計(jì)算機(jī)成績     平均成績\r\n");       for(int i=0;i<a;i++)         {         fprintf(fp,"%8d%12s%14.2f%14.2f%14.2f%14.2f\n",stu[i].number,stu[i].name,stu[i].sco.math,stu[i].sco.english,stu[i].sco.computer,stu[i].average);         fprintf(fp,"\r\n");         }       fclose(fp);       printf("信息保存成功!\n");       }   } void exit_student(void)//退出系統(tǒng)   {   exit(1);   } void print_help(void)//輸出幫助信息   {   printf("本系統(tǒng)所能容納的最大學(xué)生數(shù)為%d人\n學(xué)生信息保存在D盤根目錄下,保存文件為“學(xué)生信息.txt”。\n感謝使用!\n",N);   } void input_score1(void)//統(tǒng)計(jì)成績總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   printf("學(xué)號:%d\n",stu[c].number);   printf("姓名:%s\n",stu[c].name);   input_score3(c);   printf("新成績錄入成功!\n");   stu[c].average=input_score2(c);   } void input_score3(int a)//統(tǒng)計(jì)成績   {   printf("數(shù)學(xué)新成績:");   scanf("%f",&stu[a].sco.math);   printf("英語新成績:");   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)新成績:");   scanf("%f",&stu[a].sco.computer);   } void change_student2(int a)//修改學(xué)生資料   {   printf("學(xué)號:%d----修改為:",stu[a].number);   scanf("%d",&stu[a].number);   getchar();   printf("姓名:%s----修改為:",stu[a].name);   gets(stu[a].name);   printf("數(shù)學(xué)成績:%.2f----修改為:",stu[a].sco.math);   scanf("%f",&stu[a].sco.math);   printf("英語成績:%.2f----修改為:",stu[a].sco.english);   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)成績:%.2f----修改為:",stu[a].sco.computer);   scanf("%f",&stu[a].sco.computer);   } void change_student1(void)//修改總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   getchar();   printf("是否要修改此學(xué)生信息?(“y”代表是)");   char d;   scanf("%c",&d);   if(d=='y'||d=='Y')     {     change_student2(c);       stu[c].average=input_score2(c);     printf("信息修改成功!\n");     }   } void delete_student1(void)//刪除總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   getchar();   printf("是否刪除此條記錄?(“y”代表是)");   char d;   scanf("%c",&d);   if(d=='y'||d=='Y')     {     delete_student2(c,iNumOfStu);     printf("記錄已刪除!\n");     }   } void delete_student2(int a,int b)//刪除學(xué)生信息   {   for(int i=a;i<b-1;i++)     {     stu[i]=stu[i+1];     }   --iNumOfStu;   } void search_student1(void)//查詢總函數(shù)   {   printf("1、按學(xué)號查詢\n2、按平均分最高查詢\n請選擇:");   int c;   scanf("%d",&c);   switch(c)     {     case 1:       {       search_student2(iNumOfStu);       break;       }     case 2:       {       search_student3(iNumOfStu);       break;       }     default: break;     }   } void menu(void)//菜單調(diào)度總函數(shù)   {   print_menu();   choosemenu();   } void sort_student1(void)//排序總函數(shù)   {   printf("1、按數(shù)學(xué)成績排序\n2、按英語成績排序\n3、按計(jì)算機(jī)成績排序\n4、按平均成績排序\n請選擇:");   int c;   scanf("%d",&c);   switch(c)     {     case 1:       {       sort_student2(stu,iNumOfStu);       break;       }     case 2:       {       sort_student3(stu,iNumOfStu);       break;       }     case 3:       {       sort_student4(stu,iNumOfStu);       break;       }     case 4:       {       sort_student5(stu,iNumOfStu);       break;       }     default: break;     }   } void print_student1(int a)//顯示全部學(xué)生資料   {   printf("本班所有學(xué)生具體信息如下\n");   print_student2();   for(int i=0;i<a;i++)     {     print_student3(i);     }   } void print_student3(int a)//顯示學(xué)生信息   {   printf("%8d%12s%14.2f%14.2f%14.2f%14.2f\n",stu[a].number,stu[a].name,stu[a].sco.math,stu[a].sco.english,stu[a].sco.computer,stu[a].average);   } void print_student2(void)//顯示表頭   {   printf("  學(xué)號       姓名           數(shù)學(xué)成績       英語成績     計(jì)算機(jī)成績     平均成績\n");   } void input_student4(int a,int b)//覆蓋原信息   {   stu[a]=stu[b-1];   --iNumOfStu;   } void input_student3(int &a,int b)//判斷學(xué)號是否重復(fù)   {   if(a!=0)     {     int i=0;     do       {       if(stu[a].number==stu[i].number)         {         printf("此學(xué)號代表的學(xué)生已錄入\n1、覆蓋原信息\n2、重新輸入\n請選擇:");         int c;         scanf("%d",&c);         switch(c)           {           case 1:             {             input_student4(i,iNumOfStu);             a=iNumOfStu-1;             printf("信息已替換!\n");             break;             }           case 2:             {             printf("請重新輸入學(xué)生信息:\n");             input_student1(iNumOfStu-1);             break;             }           default: break;           }         break;         }       ++i;       }       while(i<b-1);     }   } void print_menu(void)//輸出菜單   {   printf("======歡迎來到學(xué)生信息管理系統(tǒng)======\n");   printf("      1、輸入學(xué)生資料\n");   printf("      2、刪除學(xué)生資料\n");   printf("      3、查詢學(xué)生資料\n");   printf("      4、修改學(xué)生資料\n");   printf("      5、顯示學(xué)生資料\n");   printf("      6、統(tǒng)計(jì)學(xué)生成績\n");   printf("      7、排序?qū)W生成績\n");   printf("      8、保存學(xué)生資料\n");   printf("      9、獲取幫助信息\n");   printf("      10、退出系統(tǒng)\n");   printf("====================================\n");   printf("請選擇:");   } void input_student2(void)//輸入總函數(shù)   {   char end;   printf("請輸入學(xué)生信息(在最后一個(gè)學(xué)生信息錄入完成后以“/”結(jié)束錄入):\n");   for(int i=0;(end=getchar())!='/';i++)     {     input_student1(i);     ++iNumOfStu;     input_student3(i,iNumOfStu);     }   for(int j=0;j<iNumOfStu;j++)     {     stu[j].average=input_score2(j);     }   } void input_student1(int a)//輸入學(xué)生信息   {   printf("學(xué)號:");   scanf("%d",&stu[a].number);   getchar();   printf("姓名:");   gets(stu[a].name);   printf("數(shù)學(xué)成績:");   scanf("%f",&stu[a].sco.math);   printf("英語成績:");   scanf("%f",&stu[a].sco.english);   printf("計(jì)算機(jī)成績:");   scanf("%f",&stu[a].sco.computer);   } float input_score2(int a)//計(jì)算學(xué)生平均成績   {   return (stu[a].sco.math+stu[a].sco.english+stu[a].sco.computer)/3;   } void search_student3(int a)//按平均分最高查詢并輸出   {   int max=0;   for(int i=0;i<a;i++)     {     if(stu[max].average<stu[i].average)       {       max=i;       }     }   print_student2();   print_student3(max);   } void sort_student2(student s[],int a)//按照數(shù)學(xué)成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.math>stu[max].sco.math)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student3(student s[],int a)//按照英語成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.english>stu[max].sco.english)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student4(student s[],int a)//按照計(jì)算機(jī)成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].sco.computer>stu[max].sco.computer)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } void sort_student5(student s[],int a)//按照平均成績排序   {   struct student temp;   for(int i=0;i<a-1;i++)     {     int max=i;     for(int j=i+1;j<a;j++)       if(stu[j].average>stu[max].average)         {         max=j;         }     if(max!=i)       {       temp=stu[max];       stu[max]=stu[i];       stu[i]=temp;       }     }   print_student2();   for(int k=0;k<a;k++)     {     print_student3(k);     }   } int search_student2(int a)//按照學(xué)號查找學(xué)生并輸出   {   int num;   int c;   printf("請輸入要查詢的學(xué)號:");   scanf("%d",&num);   for(int i=0;i<a;i++)     {     if(num==stu[i].number)       {       c=i;       }     }   printf("此學(xué)生的信息是:\n");   print_student2();   print_student3(c);   return c;   } void choosemenu(void)//菜單選擇   {   int i;   scanf("%d",&i);   switch(i)     {     case 1:       {       input_student2();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 2:       {       delete_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 3:       {       search_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 4:       {       change_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 5:       {       print_student1(iNumOfStu);       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 6:       {       input_score1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 7:       {       sort_student1();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 8:       {       save_student(stu,iNumOfStu);       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 9:       {       print_help();       printf("按回車鍵返回主菜單");       getchar();       getchar();       menu();       break;       }     case 10:       {       exit_student();       }     default: break;     }   }         運(yùn)行結(jié)果:                         源文件下載地址: http://115.com/file/clnq138g#一個(gè)簡單的學(xué)生成績管理系統(tǒng).rar (請將此地址復(fù)制到瀏覽器地址欄中訪問下載頁面)   #include<stdio.h> #include<string.h> #include<stdlib.h> #define N 100 int iNumOfStu=0; struct score   {   float math;   float english;   float computer;   }; struct student   {   int number;   char name[20];   struct score sco;   float average;   }; struct student stu[N]; void print_menu(void);//輸出菜單 void choosemenu(void);//菜單選擇 void input_student1(int);//輸入學(xué)生信息 void input_student2(void);//輸入總函數(shù) void input_student3(int &,int);//判斷學(xué)號是否重復(fù) void input_student4(int,int);//覆蓋原信息 void sort_student3(student s[],int);//按照英語成績排序 void sort_student4(student s[],int);//按照計(jì)算機(jī)成績排序 void sort_student2(student s[],int);//按照數(shù)學(xué)成績排序 void sort_student5(student s[],int);//按照平均成績排序 float input_score2(int);//計(jì)算學(xué)生平均成績 void print_student2(void);//顯示表頭 void print_student3(int);//顯示學(xué)生信息 void print_student1(int);//顯示全部學(xué)生資料 void sort_student1(void);//排序總函數(shù) void menu(void);//菜單調(diào)度總函數(shù) int search_student2(int);//按學(xué)號查詢學(xué)生信息并輸出 void search_student3(int);//按平均分最高查詢并輸出 void search_student1(void);//查詢總函數(shù) void delete_student2(int,int);//刪除學(xué)生信息 void delete_student1(void);//刪除總函數(shù) void change_student2(int);//修改學(xué)生資料 void change_student1(void);//修改總函數(shù) void input_score3(int);//統(tǒng)計(jì)成績 void input_score1(void);//統(tǒng)計(jì)成績總函數(shù) void print_help(void);//輸出幫助信息 void exit_student(void);//退出系統(tǒng) void save_student(student *,int);//保存學(xué)生信息 void main()   {   menu();   } void save_student(student *s,int a)//保存學(xué)生信息   {   FILE *fp;     if((fp=fopen("d:\\學(xué)生信息.txt","wb"))==NULL)       {       printf("不能打開文件!\n");       }     else       {       printf("保存信息到D盤\n");       fprintf(fp,"本班所有學(xué)生具體信息如下:\r\n");       fprintf(fp,"  學(xué)號       姓名           數(shù)學(xué)成績       英語成績     計(jì)算機(jī)成績     平均成績\r\n");       for(int i=0;i<a;i++)         {         fprintf(fp,"%8d%12s%14.2f%14.2f%14.2f%14.2f\n",stu[i].number,stu[i].name,stu[i].sco.math,stu[i].sco.english,stu[i].sco.computer,stu[i].average);         fprintf(fp,"\r\n");         }       fclose(fp);       printf("信息保存成功!\n");       }   } void exit_student(void)//退出系統(tǒng)   {   exit(1);   } void print_help(void)//輸出幫助信息   {   printf("本系統(tǒng)所能容納的最大學(xué)生數(shù)為%d人\n學(xué)生信息保存在D盤根目錄下,保存文件為“學(xué)生信息.txt”。\n感謝使用!\n",N);   } void input_score1(void)//統(tǒng)計(jì)成績總函數(shù)   {   int c;   c=search_student2(iNumOfStu);   printf("學(xué)號:%d\n",stu[c].number);   printf("姓名:%s\n",stu[c].name);   input_score3(c);   printf("新成績錄入成功!

    標(biāo)簽: c語言

    上傳時(shí)間: 2019-06-09

    上傳用戶:啊的撒旦

  • Switch Mode Power Supplies

    For many years prior to the 1970s, engineers designed and built switch mode power supplies (SMPSs) using methods based largely on intuitive and exper- imentally derived techniques. In general, these power supplies were able to achieve their primary goal of high-efficiency power conversion; unfortu- nately, due to the lack of adequate theoretical analysis techniques, many of these power supplies only marginally met their desired performance require- ments. In many cases, they were considered to be unreliable. 

    標(biāo)簽: Supplies Switch Power Mode

    上傳時(shí)間: 2020-06-07

    上傳用戶:shancjb

主站蜘蛛池模板: 清涧县| 甘泉县| 交口县| 泊头市| 新泰市| 上蔡县| 石泉县| 尼玛县| 华坪县| 紫阳县| 福安市| 呼和浩特市| 东明县| 苗栗市| 磐石市| 邹平县| 肇东市| 陈巴尔虎旗| 康乐县| 永善县| 永济市| 独山县| 吉木乃县| 大田县| 四子王旗| 即墨市| 临邑县| 黑河市| 定西市| 谢通门县| 论坛| 林州市| 晋中市| 新建县| 伊宁市| 晋江市| 靖西县| 新化县| 疏附县| 兴隆县| 厦门市|