Need help with C++ project

I don't understand what I am doing wrong, help please. Getting errors like

't': unknown override specifier
missing type specifier - int assumed.



#include<iostream>

#include<iomanip>

#include<stdlib.h>

#include<time.h>

using namespace std;

class Game

{

// private data members

private:

int balance;

int rolledValue;

char choice;

time_t t;

public:

// public member functions

// defualt constructor

Game()

{

srand((unsigned) time(&t)); // this function is used for initialize random generator

balance=0;

}

// function to set the balance

void setBalance()

{

while(true)

{

int b;

cout<<"Enter the starting balance: $";

cin>>b;

if(b>0)

{

balance=b;

break;

}

else

cout<<"Invalid balance.Try again...!!!"<<endl;

}

}

// function to roll the die and update balance

void roll()

{

rolledValue=rand()%(6-1+1)+1;

if(rolledValue%2==0)

balance++;

else

balance--;

}

// function to diplay roll value and updated balance

void display()

{

if(rolledValue%2==0)

cout<<"You rolled even value "<<rolledValue<<endl;

else

cout<<"You rolled odd value "<<rolledValue<<endl;

cout<<"Updated Balance is $"<<balance<<endl;

}

// function to check user wants to roll again or not

bool again()

{

while(true)

{

cout<<"You want to roll again or quit(y/n): ";

cin>>choice;

if(choice=='y' || choice=='Y')

{

return true;

}

else

if(choice=='n' || choice=='N')

{

return false;

}

}

}

// function to validate balance

bool validateBalance()

{

if(balance>0)

return true;

else

return false;

}

};

int main()

{

// creating Game class object

Game game;

game.setBalance(); // call setBalance() function to set starting balance

cout<<endl; // new line

while(true)

{

game.roll(); // call roll() function to roll die

game.display(); // call display() function to print rolled value and balance

// checking is balance is valid for roll again or not

// call validateBalance() function

if(!game.validateBalance())

break;

// call again() function to check user wants to roll again or not(quit)

if(!game.again())

break;

cout<<endl;

}

cout<<endl<<"*** THANK YOU ***"<<endl;

return 0;

}

Your code is too badly formatted to read.
You code works on VS 2017.
Are you sure you pasted the right code ?
What compiler / IDE do you use?
Your compiler should provide line numbers with the error.
Topic archived. No new replies allowed.