0

Im not sure whats wrong with my code but its does not give any output it only takes input and after that my terminal ends the program im using ubunto linux .

here is my code

#include <iostream>
using namespace std;

int main()
{
    int A[3][3];
    int B[3][3];

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cout << "" << i << j << ": ";
            cin >> A[i][j];
        }
    }

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            B[j][i] = A[i][j];
        }

        cout << endl;
    }

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cout << B[i][j];
        }

        cout << endl;
    }

    return 0;
}
ssd
  • 2,340
  • 5
  • 19
  • 37
daud nasir
  • 41
  • 4
  • 4
    [Can't reproduce](https://rextester.com/NMC31915). Your code works for me as written, and produces expected output. – Igor Tandetnik Apr 20 '20 at 14:12
  • 1
    "and after that my terminal ends the program" do you actually mean "the terminal closes and I cannot see the output" ? – 463035818_is_not_an_ai Apr 20 '20 at 14:13
  • [Don't get in the habit of `using namespace std;`](https://stackoverflow.com/q/1452721/430766) – bitmask Apr 20 '20 at 14:15
  • Your running code inside IDE? Sure you have selected the correct output terminal? Try to run the compiled binary from simple windows command line / bash, see if you can register any output you're expecting ;). If so, have a closer look at your IDE, probably start withe a new hello world and copy&paste your code if you have seen "Hello World" displayed on the IDE's console once. – Cutton Eye Apr 20 '20 at 14:26
  • @idclev463035818 i mean in terminal takes the input and after that it dont cout what its supposed to do ,the terminal ends the process after i give the input – daud nasir Apr 20 '20 at 14:29
  • I dont understand what that means "the terminal ends the process after i give the input" . The terminal stays open? Can you post the output you see in the terminal? (even if it is only `ij :` and your input) – 463035818_is_not_an_ai Apr 20 '20 at 14:30
  • @idclev463035818 012 023 104 115 126 207 218 229 XPS-15-9550:~$ – daud nasir Apr 20 '20 at 15:31

0 Answers0