Hi I am working on this game. I really never played it so I just read about it. I am getting three errors. I was hoping you guys can help me fix it? Thank you

Error 1 error C2059: syntax error : 'do' 2008\projects\program9\program9\craps.cpp 36 Program9
Error 2 error C2143: syntax error : missing ';' before '{' 2008\projects\program9\program9\craps.cpp 37 Program9
Error 3 error C2061: syntax error : identifier 'cout' 2008\projects\program9\program9\craps.cpp 67 Program9

#include <iostream> 
#include <cstdlib>             
#include "Dice.h"



using namespace std ; 

 int roll;
 int rollAgain;
 int stRoll;
 float bank = 50.0;
 float bet;
 int anotherRoll;

             
  
        

int main () 
{ 
	do
	{
	do
	{
		if (bet > bank)
			cout << " Sorry insuffient funds. Please enter a lower amount. " << endl;
		

		else if (bet < bank)
			cout<< "You bet $" << bet <<endl;
		while(bet > bank);
	}
		do
		   {
           roll = Throw();  
           
           if (roll == 7 || roll == 11)
		   { 
                   cout << "You win." << endl; 
               
           } 
           else if (roll == 2 || roll == 3 || roll == 12)
		   { 
                   cout << "Sorry you lose./n" << endl; 
				   bank = bank - bet;
				   cout << "You have $"<< bank << "doalrs/n"<<endl;
               
           } 
           else if (roll == 4 || roll == 5 || roll == 6 || 
                   roll == 8 || roll == 9 || roll == 10) 
		   { 
                  cout << "You rolled a point. /n" << endl; 
                        stRoll = roll; 
		   }
           
		   while (bank < 0)
		   {
			   break;
		   }
		
		}
	}

           cout << "Want to roll again? Press '1' when ready" << endl; 
		   
           cin >> anotherRoll;   
           
           if (anotherRoll == 1){ 
                   
             while (anotherRoll == 1)         
             {                               
                 rollAgain = Throw();  
                 if (rollAgain == stRoll){ 
				 cout << "Congradulations, you Win." << endl; 
                 } 
                 else if (rollAgain == 7){ 
                 cout << "Sorry, 7 came up. You crapped out." << endl; 
                 } 
                         else { 
                           cout << "You're still in the game. 7 has not yet rolled." << endl; 
                           cout << "Are you ready to roll again? Press '1' when ready" << endl; 
                         } 
                          cin >> anotherRoll;  
                 } 
                
           } 
		   else { 
                    cout << "Invalid entry" << endl;  
           }   
}

Recommended Answers

All 2 Replies

I suggest you start by stripping the code down to the smallest portion that compiles successfully and add code line by line until it breaks. That should give you some hints about where the problems are.

Hahaha I got it. it was really really stupid of me. lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.