fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int gameBoard[4][4] = {0};
  5.  
  6. int displayGame();
  7.  
  8. int main()
  9. {
  10. bool zeroFound;
  11. int k = 0;
  12.  
  13. for(int i = 0; i < 4; i++)
  14. {
  15. for(int j = 0; j < 4; j++)
  16. {
  17. cout << gameBoard[i][j] << " ";
  18.  
  19. while(zeroFound == false)
  20. {
  21. if(gameBoard[3][k] == 0) {
  22. gameBoard[3][k] = 2; zeroFound = true;
  23. }
  24. k++;
  25. cout << gameBoard[3][k];
  26. }
  27. }
  28. cout << endl;
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
0 0 0 0 
0 0 0 0 
0 0 0 0 
0 0 0 0