在linux環境下封裝課程設計
這個是我自己實現的,並不一定正確
以下是實驗步驟
課程設計封裝的部分截圖連線
(1)mkdir student(在root下建立資料夾)
(2)cd student (進入student的建立資料夾)
在建立乙個資料夾student 步驟和(1)一樣
(3)touch lib include src (在student 建立三個資料夾)
(4)ls (檢視是否建立成功)
(5)cd ..返回上級目錄(student 的資料夾下)
(6)cd include(切換到include的目錄下)
(7)touch head.h(建立 head.h檔案)
(8)gedit head.h(開啟檔案)
檔案內容為你宣告的函式
例如student *addnode(student *head);//增加
(9)cd ..返回上級目錄(student的資料夾下)
(10)cd lib(切換到lib的目錄下)
(11)touch head.c(建立head.c檔案)
(12)gedit head.c(開啟檔案)
檔案內容對函式的的實現
// 1 輸入資料
student *addnode(student *head)
if(head==null)
else
pr->next=p;
}pr=p;
printf("\n\t請輸入學號:");
scanf(" %s",&id);
printf("\n\t請輸入名字:");
scanf(" %s",&name);
printf("\n\t請依次輸入語文,數學,外語成績:");
scanf(" %d%d%d",&c1,&c2,&c3);
strcpy(pr->id,id);
strcpy(pr->name,name);
pr->c1=c1;
pr->c2=c2;
pr->c3=c3;
pr->next=null;
return head;
}(13)cd ..返回上級目錄(動態庫和靜態庫的建立的資料夾下)
(14)cd src(切換到src的目錄下)
(15)touch main.c(建立main.c檔案)
(16)gedit main.c(開啟檔案)
內容為//主選單
int main()
}else
return 0;
};(17)cd ..返回上級目錄(student的資料夾下)
(18)cd lib(切換到lib目錄下)
(19)gcc -c head.c(生成head.o檔案)
(20)ls(檢視是否生成head.o檔案)
(21)ar cr libhead.a head.o(生成靜態庫lib_.a)
(22)cd ..返回上級目錄(動態庫和靜態庫的建立的資料夾下)
(23)cd src(切換到lsrc目錄下)
(24)gcc -o main main.c -l/root/student/student/lib -lhello
-i/root/student/student/include(主意此步驟要把路徑寫對)
(25)./main(就可以得到結果了)
Linux 課程設計實驗(2)
使用快捷鍵 ctrl alt t開啟終端。烏班圖系統 1.在 exp2 mydir下,建立如下目錄結構。注意大小寫 2.1 在mydoc中建立乙個空檔案first。2 用vim開啟first,然後載入 exp2 vim.txt的內容到編輯區。3 增加新行內容,至少達到30行,然後儲存退出vim。4 ...
《C語言課程設計》一第1章 編 程 環 境 1 0
本章簡單介紹幾個常用的c語言程式設計環境,包括vc 6.0 dev c vs 2008等。不同的程式設計環境,其功能不完全一樣。有些程式設計環境 如vc 6.0和vs 2008 功能較強大,除了簡單的win32程式外,還能開發其他比較複雜的程式,如基於mfc的靜態鏈結庫 動態鏈結庫等。面向c語言程式...
在linux下搭建git環境
1 建立github賬號,2 linux建立ssh金鑰 plain view plain copy ssh keygen 一直預設就可以了 3 將公鑰加入到github賬戶資訊account settings ssh key 4 測試驗證是否成功。plain view plain copy ssh ...