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;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.