How do I get this matrix to zero in front of the F’s?

Asked

Viewed 30 times

0

I can’t leave the matrix zeroed in front of the F’s. it’s just behind.

inserir a descrição da imagem aqui

  • Use horizontal tab (t') and line break (n') to format your line. Ex.: cout << "\nF" << (l+1) << " \t"; and cout << poltronas[l][c] << "\t";. Posting images is not a welcome attitude on this site. Make a Tour and understand why.

1 answer

1

You are placing an Endl after the 'F', it will break the line and stay in front of the spaces of the previous line.

Try this:

for(int i = 0; i<18; i++){
    cout<<'F'<<(i+1);
    for(int j = 0; j<4; j++){
      cout<<poltona[i][j];
      if(j==3)
        cout<<endl;
    }
}
  • Thanks, it worked out.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.