if/else prob .. Help Pls!!!!

Using Visual Studio 2013...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include"stdafx.h"
#include<iostream>
#include<conio.h>
#include<string>
#include<Windows.h>
#include<dos.h>
#include<cstdlib>
#include<ctime>

using namespace std;

int playerInfo();

void drawline(int n, char symbol)
{
	for (int i = 0; i<n; i++)
		cout << symbol;
	cout << "\n";
}

void wlcScrn()
{
	system("cls");
	drawline(60, '_');
	cout << "\n\t\tWelcome to the Casino!\n";
	drawline(60, '_');
	playerInfo();
	system("cls");
	drawline(80, '=');
	cout << "\n\nInstructions : ";
	cout << "\n  1.Select a Number to Bid On.";
	cout << "\n  2.Enter an Amount to Bid.";
	cout << "\n  3.If the Number you Selected Comes Up, You Win Double Your Bid Amount.";
	cout << "\n  4.If the Number you selected Doesn't Show Up, You lose Your Bid Amount.";
	cout << "\n\nGood Luck";
	drawline(80, '=');
		_getch();
}

int playerInfo()
{
	string plr;
	int amount;
	cout << "\nEnter Player Name - ";
	cin >> plr;
	cout << "\nOk , Lets start " << plr << ".";
	cout << "\nEnter deposit amount (max-5000$) - ";
	cin >> amount;
	if (amount > 5000)
	{
		cout << "\nAmount Higher than 5000$, You're Kicked out of The Casino.";
		_getch();
		return 0;
	}

	else
	{
		cout << "\nYour Balance is " << amount << "$";
		_getch();
	}
}

void main()
{
	wlcScrn();
}


In function playerInfo() I want That the Program quits if the user Enters a number more than 5000... But It doesn't do so... The program forwards to Instructions...Even I have put return 0; there....Please help and tell what should i do to further progress making my game.
closed account (48T7M4Gy)
The return 0 at line 53 returns to line 27.

wlScrn is called by main so if you want the program to quit you have to return from wlscrn not just playerinfo;

I suggest you try returning the 5000+ instead of zero and doing the check in wlScrn
closed account (48T7M4Gy)
Don't make multiple posts. You spend a lot of time drawing on the volunteers here who act in good faith and you are wasting our time and effort. You might like to take your questions to some other site to do your homework.
I just posted this in Beginner and General C++ Programming for better and Faster replies...
//apologizes for doing like this but it's urgent and not my homework...

What do mean by - return from wlcscrn not just playerinfo...I dont want to end the program if the amount is under 5000$... I want to only end program if its above 5000$...

Please provide a worthy solution bro.. You cant speak to Beginners This Way... I didn't really get you...
Topic archived. No new replies allowed.