Friday, 27 September 2013

everything compiles but i dont get any kind of feed back as if the main is not calling the functions does anyone know why?

everything compiles but i dont get any kind of feed back as if the main is
not calling the functions does anyone know why?

i have tested each part individually and i know they work the problem is
when i paste the function roll_dice back in or vise verse.When i compile
the two together i get the error C2143 missing ';' before 'type' on line
32 which is the play_game function. can someone tell me why im getting
this error when they work separately but do not work when they are put
together. This is a craps game and i am a beginner at using c.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define MAX_DIE 6
#define true 1
#define false 0
int num1 = 0;
int num2 = 0;
int roll = 0;
int point = 0;
int wins = 0;
int losses = 0;
int keep_rolling = 1;
int main(void)
{
void roll_dice(int num1, int num2, int roll);
{
srand ( time(NULL));
num1 = ("%d",rand() % MAX_DIE +1);
num2 = ("%d",rand() % MAX_DIE +1);
roll = (num1 + num2);
printf("this is your number : %d\n",num1);
printf("this is your 2nd number : %d\n",num2);
printf("this is your total : %d\n",roll);
}
void play_game(int wins, int losses, int point, int roll);
{
if (( roll == 7) ||( roll == 11)){
printf("you rolled %d you won \n", roll);
wins+=1;
}
else if ((roll == 2) || (roll == 3) || (roll== 12)){
printf("you rolled %d you lost \n", roll);
losses+=1;
}
else if ((roll == 1) || (roll == 4) || (roll == 5) || (roll == 6) ||
(roll == 8) || (roll == 9) || (roll == 10)){
printf("you have pointed : %d\n", roll);
point = roll ;
printf("you rolled %d you pointed \n", roll);
while (keep_rolling = 1)
{
void roll_dice(int num1, int num2,int roll);
if(roll == point)
{
printf("you rolled %d you won \n", roll);
wins+=1;
return keep_rolling = false;
}
else if(roll == 7)
{
printf("you rolled %d you lost \n", roll);
losses+=1;
return keep_rolling = false;
}
else
{
printf("you rolled : %d\n", roll);
printf("your point is : %d\n",point);
}
}
}
}
}

No comments:

Post a Comment