0
Movie tickets c++
My code compiles the wanted result in my IDE but not in the compiler of the sololearn app. Can I see your code to see what's wrong?
7 Answers
+ 2
share your code in playground
+ 1
This here is what i had to use to make this work. The first for loop is to set up the rows and then the nested for loop is to change the values to 1 and print them out. Hope it helps.
//your code goes here
for (int x=0; x < rows; x++)
{
for (int y=0; y < cols; y++)
{
matrix[x][y] = 1;
cout << matrix[x][y];
}
cout << "" << endl;
}
0
#include <iostream>
using namespace std;
int main() {
int rows = 6;
int cols = 6;
float matrix[rows][cols] = {
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
};
// your code goes hre
for(int row=0;row<6;row++);{
// matrix[0][6]=1;
//cout<<matrix[0][0];
for(int col=0;col<6;col++){
matrix [0][6]=1;
cout<<matrix [0][6];
}
cout<<endl;
}
return 0;
}
0
My IDE was visual studios
0
Thank you guys, I was trying to put the matrix in the "for" function and it would just mess everything up. Appreciated!