Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a c++ program that plays the game of connect four. The program needs to al

ID: 3763185 • Letter: W

Question

Write a c++ program that plays the game of connect four.

The program needs to also support a single player option. The option is given at the beginning of the execution.

The program must be able to

Print an error message and recover, when the player doesn’t supply a valid column on the board. This includes selecting a column that has filled all rows.

Print an error message when the user enters an invalid option as a command line argument. You do not need to recover from this.

Play the game correctly based on how many pieces to connect or when any user fails to win by the board completely filling.

Continue to play until the user selects no.

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main(int argv, char *argv[])
{
   char ans='y';
   while(ans=='y')
   {

   if(argv>1)
   {
       cout<<"Column not vaild"<<endl;
       argv=1;
   }
  
   cout<<"Do you want to play again";
   cin=ans;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote