Skip to main content

Posts

Showing posts with the label loops

Tic Tac Toe Game using C++

TIC TAC TOE GAME using C++ One player will input 'O' and the other will input 'X' to fill the grid as above in order to get 3 in a row to win the game. SOURCE CODE: #include <iostream> using namespace std; int main() {         char x,y,z,w;         char arr[3][3];         cout<<"Start!"<<endl;         for(int i=0;i<3;i++)                 for(int j=0;j<3;j++)                 {                         cin>>arr[i][j];                 }         for(int l=0;l<3;l++)         {                 x=arr[l][0];                 z=arr[0][l]; ...
Printing patterns using 'for' loops in C++ #include <iostream> using namespace std; int main () {         for (int i=0;i<=10;i++) //No.of rows         {                 for (int j=0;j<=10;j++) // No. of columns                 {                         cout<<"*";                 }                 cout<<endl;         }         return 0; } #include <iostream> using namespace std; int main () {         for (int i=0;i<=10;i++)         {                 for (int j=0;j<=i;j++)               ...