Hi,
I'm trying to write a simple program to roll a die. So far, here is what I have:
Code:
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
int main(void)
{
char *roll = "roll";
char *exit = "exit";
char input[10];
printf("Command: ");
gets(input);
while((strcmp(input,roll) == 0) && (strcmp(input,exit) != 0))
{
printf("%d", 1 + (srand(time(NULL)) % 4));
}
return 0;
}
However, when I try to compile, I get an error in line 20 (the print statement) saying "void value not ignored as it ought to be".
Does anyone have any ideas?
Thanks.