|這個作業屬於那個課程|c語言程式設計ii
| -------- | -----: | :----: |
|這個作業要求在**|
|我在這個課程的目標是|學會運用指標陣列,陣列指標,指標函式,函式指標,二級指標,單向鍊錶解決相關的題目
|這個作業具體在那個方面幫助我實現目標|本週的題目需要用到單向鍊錶解決問題
|參考文獻|c語言程式設計ii
計算最長的字串長度:
本題要求實現乙個函式,用於計算有n個元素的指標陣列s中最長的字串的長度。
函式介面定義:
int max_len( char *s, int n );
其中n個字串儲存在s中,函式max_len應返回其中最長字串的長度。
裁判測試程式樣例:
輸入樣例:#include #include #include #define maxn 10
#define maxs 20
int max_len( char *s, int n );
int main()
; scanf("%d", &n);
for(i = 0; i < n; i++)
printf("%d\n", max_len(string, n));
return 0;
}/* 你的**將被嵌在這裡 */
輸出樣例:4
blue
yellow
redgreen
6實驗**:
統計專業人數
本題要求實現乙個函式,統計學生學號鍊錶中專業為計算機的學生人數。鍊錶結點定義如下:
struct listnode ;
這裡學生的學號共7位數字,其中第2、3位是專業編號。計算機專業的編號為02。
函式介面定義:
int countcs( struct listnode *head );
其中head是使用者傳入的學生學號鍊錶的頭指標;函式countcs統計並返回head鍊錶中專業為計算機的學生人數。
裁判測試程式樣例:
輸入樣例:#include #include #include struct listnode ;
struct listnode *createlist(); /*裁判實現,細節不表*/
int countcs( struct listnode *head );
int main()
/* 你的**將被嵌在這裡 */
輸出樣例:1021202
2022310
8102134
1030912
3110203
4021205
#
3
實驗**:
流程圖:int countcs( struct listnode *head )

pta執行截圖
刪除單鏈表偶數節點
本題要求實現兩個函式,分別將讀入的資料儲存為單鏈表、將鍊錶中偶數值的結點刪除。鍊錶結點定義如下:
struct listnode ;
函式介面定義:
函式createlist從標準輸入讀入一系列正整數,按照讀入順序建立單鏈表。當讀到−1時表示輸入結束,函式應返回指向單鏈表頭結點的指標。struct listnode createlist();
struct listnode deleteeven( struct listnode *head );
函式deleteeven將單鏈表head中偶數值的結點刪除,返回結果鍊錶的頭指標。
裁判測試程式樣例:
輸入樣例:#include #include struct listnode ;
struct listnode *createlist();
struct listnode *deleteeven( struct listnode *head );
void printlist( struct listnode *head )
printf("\n");
}int main()
/* 你的**將被嵌在這裡 */
1 2 2 3 4 5 6 7 -1
輸出樣例:
1 3 5 7
實驗**:
流程圖:struct listnode *createlist()
return head;
};struct listnode *deleteeven( struct listnode *head )
p1 = head;
while(p1!=null)
p1= p1->next;
} return head;
}

pta執行截圖
預習作業:
從第十三周開始,將進入課程設計階段,請在本次作業中給出:
1.所在小組想要開發的專案的名稱和目標;
還在構思
2.專案主體功能的描述;
還在構思
3.現階段已做的準備工作;
網上查詢相關資料尋找思路
4.小組成員名單和進度安排。(課程設計階段:13-17周)
楊梓欣,羅騰龍,徐一涵
第十二周作業
例題1 includeusing namespace std struct date struct student int main stu1,stu2 stu1.num 1001 stu1.age 20 stu2 stu1 cout includeusing namespace std struc...
第十二周作業
1 多文件窗體 mdi form 功能演示 2 日期控制項datetimepicker功能演示 3 月曆控制項monthcalender功能演示 4 樹型列表控制項treeview功能演示 tn.expand 展開tn節點 treeview1.selectednode tn1 把新增節點設定為當前選...
第十二周作業
一.jpanel 方法型別 描述public jpanel 構造建立乙個預設的jpanel物件,使用流布局管理器 public jpanel layoutmanager layout 構造建立乙個指定布局管理器的jpanel物件 二.jsplitpane 三.jtabbedpane 四.jscrol...