In C how do I draw two verticall lines on a tic tac toe boar
In C++ how do I draw two verticall lines on a tic tac toe board (150 x 150) at x = 50 and x 100
in black
thanks
Solution
Please follow the code and comments for description :
CODE :
#include <iostream> // required initialisations
using namespace std;
int main() // driver method
{
for(int i = 1; i <= 5; i++) { // this is the loop that prints the row
for(int j = 1; j <= 5; j++){ // this is the loop that prints the columns
if(j == 2 || j == 5){ // checking for the given condition
cout << \" | \" ; // printing the line required
} else {
cout << \" * \" ; // else a normal character
}
}
cout << endl; // new line character
}
return 0;
}
OUTPUT :
* | * * |
* | * * |
* | * * |
* | * * |
* | * * |
NOTE :
This is just a sample with dummy values, please replace the code with the requirements as given below,
a) Run the loop for the rows from the value 1 to 150 and the same with the columns loop.
b) In the inner for-loop while checking the row index change the values to check 50 and 100 as per the requirements.
Hope this is helpful.
