c 自學筆記第五次

2021-06-28 18:51:05 字數 1030 閱讀 7920

**重用是現代程式設計追求的乙個重要目標,模板有效地軟體重用。模板和異常處理都是c++的重要機制。利用模板可以大大縮短了程式的長度。

#include

using namespace std;

template

class a

void display()

};int main() 

函式模板

#include

using namespace std;

template

t sum(t a,t b) 

int isum(int a,int b) 

float fsum(float a,float b)

int main();

int main();

class yc2{};

int main()

catch(yc1)

catch(yc2){

cout<<"面積不可以大於100"<

#include

using namespace std;

int main(){

ofstream ofile("11111.txt"); //以文字形式開啟檔案 

if(!ofile)

cerr<<"開啟檔案錯誤"<

#include

using namespace std;

int main(){

ofstream ofile;

ifstream ifile;

char buf1[30],buf2[30];

ofile.open("11111.txt");//開啟檔案。寫入 

ofile<<"hello 彤彤";

ofile<<"i love you";

ofile.close();//關閉檔案

ifile.open("11111.txt");  //開啟檔案,進行讀操作 

ifile.getline(buf1,30);

ifile.getline(buf2,30);

cout<

2018 9 7第五次筆記

這次筆記是接著上上一次筆記繼續介紹基本linux命令的。5.mv move,移動 作用 在目錄建移動檔案,重新命名檔案,在需要的情況下,可以移動並重命名。基本格式 mv 原始檔pathname 目的檔案pathname 下圖是mv命令的結果顯示 wb ubuntu wb ls 1.txt arm c...

Python第五次筆記

import hashlib md hashlib.md5 md.update 你好 md md.hexdigest print md 出現以下錯誤 d pycharmprojects untitled venv scripts python.exe d pycharmprojects untitl...

c 第五次實驗

一 問題及 檔名稱 railgun 作 者 尚文宇 完成日期 2016 年 5 月 4 日 版 本 號 v1.0 對任務及求解方法的描述部分 輸入描述 無 問題描述 陣列分離 程式輸出 略 問題分析 略 演算法設計 略 三 心得體會 陣列和迴圈與if的結合運用還是很有意思的 四 知識點總結 陣列的輸...