<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] ##### 二維數組的動態分配 ``` /** * 二位數組的動態分配。 * function : malloc() **/ #include <stdio.h> #include <malloc.h> int main(void) { int n; int i,j; int **a; scanf("%d",&n); a = (int **)malloc(sizeof(int *) * n); for(i=0;i<n;i++) { a[i] = (int *)malloc(sizeof(int) * n); } for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<n;i++) { for(j=0;j<n;j++) { printf("%d\t",a[i][j]); } printf("\n"); } return 0; } ``` ##### switch,case語句 ``` #include <stdio.h> int main(void) { int b = 1; switch(b) { case 1: printf("this is 1\n"); break; case 2: printf("this is 2\n"); break; case 3: printf("this is 3\n"); break; case 4: printf("this is 4\n"); break; default: printf("this is other\n"); } return 0; } ``` ##### 課程設計代碼實例 ``` #include <stdio.h> #include <malloc.h> /** * @author:QD * @time:2016/11/21 * @func: * */ int choose = -1; struct NodeN{ int sn; int score; struct NodeN *next; }; typedef struct NodeN *Node; //function define void myinit(); void scoreEnter(Node project[]); void insert(int projectNumber,Node project[],Node tmp); Node locate(Node L,int score); void myinit() { printf("--------------------------------------------------------------\n"); printf("----------------------welcome my system!!!--------------------\n"); printf("-------(1)-Enter the score and school number!-----------------\n"); printf("-------(2)-enter the score and school number!-----------------\n"); printf("-------(3)-enter the score and school number!-----------------\n"); printf("-------(4)-enter the score and school number!-----------------\n"); printf("-------(5)-enter the score and school number!-----------------\n"); printf("-------(6)-Quit!----------------------------------------------\n"); printf("--------------------------------------------------------------\n"); printf("Please enter the number you want to choose:\n"); //..... scanf("%d",&choose); return ; } void scoreEnter(Node project[]) { //init node int projectNumber; Node tmp = (struct NodeN *)malloc(sizeof(struct NodeN)); //scanf("please enter the project number:%d\n",&projectNumber); //scanf("please enter the number:%d\n",&(tmp->sn)); //scanf("please enter the score:%d\n",&(tmp->score)); printf("Please enter the project number:"); scanf("%d",&projectNumber); printf("Please enter the school number:"); scanf("%d",&(tmp->sn)); printf("please enter the score:"); scanf("%d",&(tmp->score)); insert(projectNumber,project,tmp); } void insert(int projectNumber,Node project[],Node tmp) { //project[projectNumber] Node L = project[projectNumber]; if(L->next == NULL) { // empty tmp->next = NULL; L->next = tmp; } else { Node p = locate(L,L->score); tmp->next = p->next; p->next = tmp; } } Node locate(Node L,int score) { Node tmp = L; while(tmp->next != NULL) { if(tmp->next->score > score) { return tmp; } tmp = tmp->next; } return tmp; } void print(Node L) { Node tmp = L->next; while(tmp!=NULL) { printf("school number is %d\t",tmp->sn); printf("score is %d",tmp->score); printf("\n"); tmp = tmp->next; } } int main(void) { //init Node project[40]; int i; for(i=0;i<40;i++) { Node tmp = (struct NodeN *)malloc(sizeof(struct NodeN)); tmp->sn = -1; tmp->score = -1; tmp->next = NULL; //empty linked list project[i] = tmp; } //user begin for(;;) { myinit(); switch(choose) { case 1: scoreEnter(project); break; //... default: printf("bye!\n"); return 0; } } //test //print(project[2]); return 0; } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看