I don't know my else if isn't working. I checked on paper and both conditions are fulfilled. When I run it I get 25,24,...,21 and then 0 and some random big numbers.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
int tablica[5][5];
int x=0,y=1,n=25,i=0;
int tablica2[5][5];
for(i=0;i<9;i++)
{
if(y==1 && x<5)
{
tablica[x+1][y] = n;
tablica2[x+1][y] = tablica[x+1][y];
//cout << tablica[x+1][y];
n--;
x++;
}
else if(x==5 && y<5)
{
cout << "xd";
}
}
cout << tablica2[1][1] << endl;
cout << tablica2[2][1] << endl;
cout << tablica2[3][1] << endl;
cout << tablica2[4][1] << endl;
cout << tablica2[5][1] << endl;
cout << tablica2[5][2] << endl;
cout << tablica2[5][3] << endl;
cout << tablica2[5][4] << endl;
cout << tablica2[5][5] << endl;
return 0;
Aucun commentaire:
Enregistrer un commentaire