Create a tic-tac-toe board with the dimensions the user entered
Mar 1, 2015 at 10:26pm UTC
Why isn't my code printing out anything except:
"Please enter a number 3 and 9: 5
Press any key to continue. . ."
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
int sizeofTable;
char letterOne = 'X' ;
char letterTwo = 'O' ;
cout << "Please enter a number between 3 and 9: " ;
cin >> sizeofTable;
for (char letterOne = 'X' ; letterOne <= sizeofTable; letterOne++){
for (char letterTwo = 'O' ; letterTwo <= sizeofTable; letterTwo++){
cout << letterOne * letterTwo;
}
cout << endl;
}
return 0;
}
Mar 2, 2015 at 3:17am UTC
cout << letterOne * letterTwo;
prints out the ascii value of the product of 'X' and 'O'. That's not a character, and I believe that it's exiting when it gets that not character.
Mar 2, 2015 at 5:54am UTC
Got it!
Mar 2, 2015 at 11:17am UTC
calisabeth, does it work? and can I get the codes? Please?
Topic archived. No new replies allowed.