我已經創建了一個長度和寬度的二維數組。我沒有得到控制檯的結果[C++]
我的minGW編譯器說什麼都沒有建立。 這裏是代碼:
#include <iostream>
using namespace std;
const int rows = 5;
const int coloms = 5;
int Matrix[rows][coloms];
void ClearMatrix()
{
for(int i=0; i < rows; i++)
{
for(int j=0; j < coloms; j++)
{
Matrix[i][j] = 0;
}
}
}
void ShowMatrix()
{
for(int i; i < rows; i++)
{
for(int j; j < coloms; j++)
{
cout<< Matrix[i][j];
}
}
}
int main()
{
ClearMatrix();
ShowMatrix();
return 0;
}
我在做什麼錯在這裏?
你用什麼命令來編譯它? – negacao
但是當我添加一行代碼cout <<「text」;到int main(){} 它只打印文本 – Anonymous
問題不在代碼中,而是在您嘗試用來構建可執行文件的命令中。你如何編譯?請張貼你正在使用的任何命令。 – automaton