You code was so bad that it is not even C. It sorta kinds (if your really not paying attention) looks like C code, but it really REALLY isn't.
What I have done is fixed it so that what is there will compile. That does not mean it is done...
DO NOT RUN THE PROGRAM AS IS: it is an infinite loop -- well providing it starts at all it is an infinite loop, I suppose you have a chance that it will not start at all. (if you do run it, press ctrl+C to exit).
The code currently does nothing but infinitely bug people to press 1.
Some notes:
#1 you must declare a variable before you use it.
#2 Functions are not defined inside of other functions. Generally they are declared at the top of the program, and then defined after main(). (Though this is just convention -- as long as they are declared and/or defined before they are used you are good).
#3 assignment is not the same as comparing for equality ("=" != "=="). To compare if two values are equal use "A == B" not "A = B", the second is an assignment and copies the value of B into A (so then A DOES == B because you just made it so).
#4 Logic statments in C use || for OR and && for AND. So conditions should look like:
if(roll1 == 1 || roll2 == 1) rather than:
if(roll1 = 1 OR roll2 = 1)I am sure that I fixed a great many other things (I commented out any code that didn't really have anything to do with C), but you job is to use this as a jumping off point. Good luck:
CODE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int Dice1();
int Dice2();
void Player1();
int Player2();
int main(int argc, char *argv[])
{
int Player1Total;
int Player2Total;
int Player1;
int Player2;
while (Player1Total<100 && Player2Total<100)
{
do
{
printf("Roll again press 1? ");
scanf("%d", &Player1);
} while (Player1 == 1);
do
{
printf("Roll again press 1? ");
scanf("%d", &Player2);
} while (Player2 == 1);
}
system("pause");
return 0;
}
void Player1()
{
int roll1;
int roll2;
int Player1Total;
roll1 = Dice1();
roll1 = Dice2();
if(roll1 == 1 || roll2 == 1)
{
// Points for turn only are lost
// End turn
}
else if(roll1 == 1 && roll2 == 1)
{
// all points are lost
// End turn
}
else
{
Player1Total = roll1 + roll2;
if(Player1Total >=100)
{
// Declare winner
}
}
}
int Player2()
{
int roll1;
int roll2;
int Player2Total;
roll1 = Dice1();
roll2 = Dice2();
if(roll1 == 1 || roll2 == 1)
{
// Points for turn are lost
// End Turn
}
else if(roll1 == 1 && roll2 == 1)
{
// all points are lost
// end turn
}
else
{
Player2Total = roll1 + roll2;
if(Player2Total >= 100)
{
// Declare Winner
}
}
}
int Dice1()
{
int roll;
srand (time(NULL));
roll = rand() %6 + 1;
return roll;
}
int Dice2 ()
{
int roll;
srand (time(NULL));
roll = rand() %6 + 1;
return roll;
}