請教:C++基礎知識

明朝2013 明朝2013 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
1、請理解程式的意圖並將空缺的代碼補上
[程式說明]:在 n 行 n 列的矩陣中,每行都有最大的數,本程式求這 n 個最大數中的最小一個。
[代碼]
#include〈stdio.h〉
#define N 100int a[N][N];
void main()
{ int row ,col ,max ,min ,n;
/*輸入合法 n (〈100 ),和輸入 m ×n 個整數到陣列 a 的代碼略*/
for ( row = 0;row < n;row++) {
for ( max = a[row][0],col = l ;col < n;col++)
if (__(1)__) max = a[row][col];
if (__(2)__) min = max;
else if(__(3)__) min = max;
}
printf ("The min of max numbers is %d\n",min);
}
2、下面代碼錯在哪里?錯誤原因是什麼?並請寫出正確的代碼。
class Human{
private:
void MakeNoise();
Public:
Void MakeMouth();
};
int main(void)
{
Human *Bigman;
Bigman->MakeMouth();
return 0;
}

3、下面是一個矩形類的聲明,請寫出代碼實現公共聲明中的三個函數。
Class Rect{
Private:
Int Width,Length; //寬度,長度
Public:
Void Rect(int W,int L); //構造函數
Int GetWidth(); //獲取寬度
Int GetArea(); //獲取面積

...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
明朝2013
C++ Builder 13,871 成员 102,696 内容