I have problem with this, how to make the output is
Input n = 5
----1----
----2----
----3----
----4----
123456789
----6----
----7----
----8----
----9----
my code :
cout<<"Input n = ";
cin>>n;
for (i=1; i<=9; i++) {
for (j=1; j<=9; j++) {
if (i==n || j==n) {
cout<<j;
}
else {
cout<<"-";
}
}
cout<<endl;
}
output of my code : Input n = 5
----5----
----5----
----5----
----5----
123456789
----5----
----5----
----5----
----5----
Aucun commentaire:
Enregistrer un commentaire