Start New Discussion within our Software Development Community

Hi there, I recently recieved some intructions to make a program using a "do while loop". Here is the questions below....by the way i am very new to C++:

"Your program begins by randomly assigning the user an amount of money (from $1 - $1000), and then after each round, updates the person’s money as appropriate. To solve the “going below zero problem, the new rules are as follows: if the user is correct, they win 5 times their bet; if they are wrong, they simply lose their bet. Now that you know how, be sure to check that their bet is allowed (ie. Not more than they have left!) As well, after each round, the program should check to see if the person has any money left. If not, the program should end; if there is money, the person should be asked if they want to play again. When the game is over, be sure to print an appropriate message either congratulating the winner or taunting the user"

I have written most of the program the only part i need help are from the above question: "After each round, the program should check to see if the person has any money left. If not, the program should end; if there is money, the person should be asked if they want to play again. When the game is over, be sure to print an appropriate message either congratulating the winner or taunting the user"

==> I would appreciate absolutely any help whatsoever!!Thanks a lot in advance!!

BTW I have included the .CPP File If That Will Help Out....

Plz Help....I Need To Know This I Am Going To Be Tested On This Area On Nov 29...Thanx A Lot Once More!

Attachments
// DAKOTA (DICE PROGRAM).cpp : Defines the entry point for the console application.
#include <iostream>
#include <time.h>
using namespace std;
int main(int argc, char* argv[])
{	int bet_amount;
	int random_bet;
	int total;
	int seed;
	int i;
	int die1;
	int die2;
	char play_again;
	seed = (((unsigned) time (NULL))%100);
	srand(seed);
	for(i=1;i<=seed;i++)
	rand()/32767;
	random_bet=1+1000*rand()/32767;
	do
	{	die1 = 1+6*rand()/32767;
		die2 = 1+6*rand()/32767; 
		cout<<"        ==> Welcome To Ahmad's Famous (DICE) Dakota Program <=="<<endl;
		cout<<"        -------------------------------------------------------"<<endl;
		cout<<endl;
		cout<<"==> How Much Money Would You Like To Bet Today (Between $1 - "<<random_bet<<")";
		cin>>bet_amount;
		while	((bet_amount>random_bet) || (bet_amount<1))
		{	cout<<"!! The Amount That You Have Entered Is Not Between $1 - $"<<random_bet<<")!!"<<endl;
			cout<<"==> How Much Money Would You Like To Bet Today (between $1 - "<<random_bet<<")";
			cin>>bet_amount;
		}
		cout<<endl;
		cout<<"==> What Do You Think The Sum Of The Two Dies Will Be ? ==> ";
		cin>>total;
		cout<<endl;
		switch (die1)
		{	case 1:  cout<<"***********"<<endl;
		             cout<<"*         *"<<endl;
					 cout<<"*    1    *"<<endl;
				     cout<<"*         *"<<endl;
				     cout<<"***********"<<endl;
				     break;
			case 2:  cout<<"***********"<<endl;
                     cout<<"*2        *"<<endl;
				     cout<<"*         *"<<endl;
				     cout<<"*        2*"<<endl;
				     cout<<"***********"<<endl;
					 break;
			case 3:  cout<<"***********"<<endl;
				     cout<<"*3        *"<<endl;
				     cout<<"*    3    *"<<endl;
				     cout<<"*        3*"<<endl;
				     cout<<"***********"<<endl;
				     break;
			case 4:  cout<<"***********"<<endl;
				     cout<<"*4       4*"<<endl;
				     cout<<"*         *"<<endl;
				     cout<<"*4       4*"<<endl;
				     cout<<"***********"<<endl;
					 break;
			case 5:	 cout<<"***********"<<endl;
					 cout<<"*5       5*"<<endl;
					 cout<<"*    5    *"<<endl;
					 cout<<"*5       5*"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 6:  cout<<"***********"<<endl;
					 cout<<"*6       6*"<<endl;
					 cout<<"*6   6   6*"<<endl;
					 cout<<"*6       6*"<<endl;
					 cout<<"***********"<<endl;
					 break;
		}

		switch (die2)
		{	case 1:  cout<<"***********"<<endl;
					 cout<<"*         *"<<endl;
					 cout<<"*    1    *"<<endl;
					 cout<<"*         *"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 2:  cout<<"***********"<<endl;
					 cout<<"*2        *"<<endl;
					 cout<<"*         *"<<endl;
					 cout<<"*        2*"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 3:  cout<<"***********"<<endl;
					 cout<<"*3        *"<<endl;
					 cout<<"*    3    *"<<endl;
					 cout<<"*        3*"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 4:  cout<<"***********"<<endl;
					 cout<<"*4       4*"<<endl;
					 cout<<"*         *"<<endl;
					 cout<<"*4       4*"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 5:	 cout<<"***********"<<endl;
					 cout<<"*5       5*"<<endl;
					 cout<<"*    5    *"<<endl;
					 cout<<"*5       5*"<<endl;
					 cout<<"***********"<<endl;
					 break;
			case 6:  cout<<"***********"<<endl;
					 cout<<"*6       6*"<<endl;
					 cout<<"*6   6   6*"<<endl;
					 cout<<"*6       6*"<<endl;
					 cout<<"***********"<<endl;
					 break;
		}
		cout<<endl;
		if	((total) == (die1+die2))
			{cout<<"You're RIGHT!! The Total Is ==> "<<die1 + die2<<" !!"<<endl;
	         cout<<endl;
			 cout<<"==> GUESS WUT?? YOU WIN!! ... ==> $"<<bet_amount*5<<"!! Because...."<<endl;
			 cout<<endl;
			 cout<<" ==> "<<bet_amount<<" * 5 ==> = "<<bet_amount*5<<" <=="<<endl;
			}
			
		else
			{cout<<"==> ENNGH!! UR WRONG! Actually The Answer Is ... ==> "<<die1+die2<<endl;
			 cout<<endl;
		     cout<<"==> Sorry Dude....U Just Lost Your Bet :( Of..."<<bet_amount<<endl;
		     cout<<endl;
			 cout<<"==> !! :) Thanks For Da Donation :) !! <=="<<endl;
			 cout<<endl;
			}
	
		{cout<<"==> Would You Like To Play Again Y/N ?? ==> ";
		 cin>>play_again;
		}
	}while ((play_again!='N')&&(play_again!='n'));
	
	return 0;
	
}

so what's the problem? Don't you know how to use a conditional statement, a return statement, or what the condition should look like?

I'm not going to open your attachment, follow the guidelines for posting code and maybe I'll have a look...

This article has been dead for over six months. Start a new discussion instead.