0

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;  
           }   
}

Edited by WaltP: Added CODE Tags

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by NotSneaky
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.