要求:計算**的注釋行,**行,空行和總行數。
步驟解析:先開啟檔案,讀取檔案,因為注釋行開頭以//或者///開頭,所以有//或者///的行為注釋行。空行就是什麼都沒有的,為空的。**行就是有**的,實現這些功能的過程中需要用到trim這個函式。
**如下;
結果顯示:using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.threading.tasks;
using system.io;
else if (line == "")
else}}
}catch (exception e)
finally
catch (ioexception e)}}
}}
c 第一次作業
using system using system.collections.generic using system.linq using system.text using system.threading.tasks using system.io using system.text.regul...
c 第一次作業
c 第一次作業 一 程式設計分析題。1.分析程式寫出結果 x,y 15,25 x,y 15,25 x,y 15,25 x,y 14,26 include using namespace std voidf1 int x,int y voidf2 int x,int y voidf3 int x,in...
C 第一次作業
c 作業1 編寫乙個程式,要求從螢幕輸入你的名字和年齡,在螢幕顯示你的名字和你明年的年齡。include include using namespace std intmain 在螢幕上輸入兩個整數,求兩個數的差,並將結果運算出來。include include using namespace st...