Mirage Source
Dice Game - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24)
+----- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=27)
+----- Thread: Dice Game (/showthread.php?tid=2743)



Dice Game - Tony - 13-04-2009

My first game programmed with C++
No tutorial was followed, just all my knowledge from 17 online lessons Big Grin

People that do know C++, feedback on the source and what I can do better to improve
my programming skills would be appreciated.

source code: [spoiler][code]#include
#include


void RollDice(int iPlayerGuess);
void GiveGold(int iAmount);
void TakeGold(int iAmount);
void PlayerWin(int iDie1, int iDie2);
int iPlayerGold;

void main() {
int iPlayerGuess;
std::cout iPlayerGuess;
RollDice(iPlayerGuess);
}

void RollDice(int iPlayerGuess) {
time_t t;
time(&t);
srand(t);
int iDie1;
int iDie2;

if (iPlayerGuess < 0 || iPlayerGuess > 12){
main();
}

std::cout


Re: Dice Game - Pbcrazy - 13-04-2009

may i ask where you got your 17 online lessons?


Re: Dice Game - Tony - 13-04-2009

http://xoax.net/comp/cpp/index.php

I've reached lesson 17 in a day. He explains so much in so little time which amazes me.


Re: Dice Game - Pbcrazy - 13-04-2009

sweet thanks, i'll be sure to watch them.


Re: Dice Game - Dragoons Master - 14-04-2009

WTF???
Code:
if (iPlayerGuess < 0 || iPlayerGuess > 12){
      main();
   }
That's just not a good programming practice. Use a while, try to avoid recursions at most!


Re: Dice Game - Tony - 14-04-2009

Dragoons Master Wrote:WTF???
Code:
if (iPlayerGuess < 0 || iPlayerGuess > 12){
      main();
   }
That's just not a good programming practice. Use a while, try to avoid recursions at most!

Oh! Alright Smile

Anyways, I've added you on MSN.


Re: Dice Game - katcode - 16-04-2009

Wow XoaX's Tutorials are Really good.
Thanks for sharing them Big Grin