int main(void)
{
/ Initialize variables and function prototype/
unsigned int seed;
int heads = 0, tails = 0, tosses, k, x;
/* Get user inputs */printf("Enterthenumberoftosses:\n");scanf("%lf",&tosses);printf("Enterapositiveintegerseedvalue:\n");scanf("%u",&seed);srand(seed);/* Generate a certain number of tosses. */for(k=1;k<=tosses;k++)x=rand()%2;ifx=1heads++;elsetails++;/* Print Outputs to screen */printf("NumberofHeads:%fandNumberoftails:%f",heads,tails;system("PAUSE");/* Exit Program */return0;
include <stdio.h>
include <stdlib.h>
int main(void)
{
/ Initialize variables and function prototype/
unsigned int seed;
int heads = 0, tails = 0, tosses, k, x;
}
/-------------------------------------------------------------------------/
????????????????????????????????????????????
This syntax:
if x = 1
Is wrong on several levels, it is missing () around the condition, and it is using the wrong symbol
=
does assignments
==
does comparisons
it probably should look like
if (x == 1)
perhaps. There are other code errors. I think you are missing some
{}
ALSO,
printf("Number of Heads: %f and Number of tails: %f", heads, tails;
See anything missing here? Hint )
Your code doesn't compile because it has errors. Logical and syntactical.
Wayne