This is my program for making a coin flip simulator, this is for school so I have to use my own code. But I need help the idea is to multiply the variable coin by 3.3 and then rounding off the decimals checking if its odd or even and associating that with heads or tails but I keep getting this error:
(Error 2 error LNK1104: cannot open file 'gdi32.lib' F:\HopelessArts\UTILITIES\coinFlip\coinFlip\LINK coinFlip)
I have no Idea what this means... here is my syntax:
#include <stdio.h>
int main(void) {
//coin flip program 100x should be 50/50 heads tails
int coin;
int heads;
int tails;
int counter;
coin = 3;
heads = 0;
tails = 0;
for (counter = 0; counter < 100; counter++) {
coin = coin * 3.3;
if (coin % 2 == 0) {
heads++;
} else {
tails++;
}
printf("Heads, tails %d%d", heads, tails);
}
}
Hey all I fixed the library issue by installing(or re installing unsure) the windows sdk and I fixed my code using the rand function like this:
#include <stdio.h>
#include <stdlib.h>
int main() {
//coin flip program 100x should be about 50/50 heads tails
int coin;
int heads;
int tails;
int counter;
heads = 0;
tails = 0;
for (counter = 0; counter < 100; counter++){
coin = rand();
if (coin%2 == 0 ){
heads++;
}
else{
tails++;
}
printf("%d,%d ", heads, tails);
}
printf("listed heads first then tails.");
system("pause");
}
Thanks for all the input! I will research all of your answers though to become a better programmer!