Question
Getting this error. [Error] expected ';' after class definition #include #include #include #include using namespace std; int sum=0; class Coin { int sideUp; public: Coin(int
Getting this error. [Error] expected ';' after class definition
#include
#include
#include
#include
using namespace std;
int sum=0;
class Coin
{
int sideUp;
public:
Coin(int value)
{
toss(value);
};
void toss(int value);
}
void Coin::toss(int value)
{
if(rand() %100<=50)
{
sum+=value;
cout<<" You got a head. Value "< } else { cout<<" You got a tail. No value added"; } } int main() { int temp; cout<<" Quarter = 25 cents Dime = 10 cents Nickel = 5 cents "; cout<<" If the final sum is 100 cents (1 dollar), you win. Else you lose!! All set to play the game?? Press enter when you are ready! "; getch(); while(sum<100) { temp=rand() %100; if(temp<=30) { Coin nickelObj(5); } else if(temp<=65) { Coin dimeObj(10); } else { Coin quarterObj(25); } } cout<<" Total value added to the Sum = "< if(sum==100) cout<<" *** You win ***"; else cout<<" *** You lose ***"; getch(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started