here is the problem:
each of three people tosses a coin. if all three tosses are heads or all three tosses are tails, the game is a draw. if two of the tosses are one type and the third one is different, the third one loses. write a program to score this game. 0 represents a head and 1 represents a tail.
here is what i have thus far:
__________________________________Code:# include <iostream> using namespace std; int main (void) int first, second, third; cout << "input the first player's toss: "; cin >> first; cout << "input the second player's toss: "; cin >> second; cout << "input the third player's toss: "; cin >> third; if (first=1) {first=second && third;} cout << "the game is a draw." << endl; if (first=0) {first=second && third;} cout << "the game is a draw." << endl; if (first=1) {second=0; third=0;} cout << "the loser is player 1." << endl;
I know that this is not finished, however I'm not sure what is the easiest way to use "if" statements in this algorithm. any help would be great appreciated, thanks.



LinkBack URL
About LinkBacks


