Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dice Game
#1
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
Reply
#2
may i ask where you got your 17 online lessons?
Reply
#3
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.
Reply
#4
sweet thanks, i'll be sure to watch them.
Reply
#5
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!
Reply
#6
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.
Reply
#7
Wow XoaX's Tutorials are Really good.
Thanks for sharing them Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)