0

This suppose to be a simple coin toss program that tells when the coin is fliped it reads heads or tails and this is wat i got so far

#include <stdio.h>

int example (int h,int t );

int main()

{

int x1, x2;
int x;

printf(" Enter 5 to run the program or 6 to exit " );
scanf("%d%d", x1, x2 );

if ( x == 5);

Example (x1);

if (x1 == 0);
printf(" heads\n");

else


if (x2==0);
printf("tails\n");

return 0;

}

int example (int x);

{

x= rand() % 1

return(x);

}

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jephthah
0

SALEM, he's actually getting better. his first 2 posts were "do this for me" without any code whatsoever.

now at least he's putting up some code.

FREDMAC:

what, exactly, do you expect this block of code to do?

printf(" Enter 5 to run the program or 6 to exit " );
scanf("%d%d", x1, x2 );

if ( x == 5);

and then once you've explained what you "expect" it to do, please tell me how you think it's going to do that.

and this is just your first problem. they get worse after this.

we can certainly sort through them all, but it's not going to be easy. you are missing some real fundamental concepts. and i suspect your semester is coming to an end soon.

by the way, this is not "C+" code. do you know which class you're in? you might want to seriously reconsider my final suggestion from your previous thread. it was serious.

.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.