//Jun Chen z3186837 //8th April 07 //Yahtzee scoring system for Assign1.c #include void IIF(int c) { if ((c>5)||(c<1)||(c!=' ')) { printf ("Incorrect Input Format.\n"); } } void OOR(int c) { if (c!=(1||2||3||4||6||' ')) { printf ("Value Out Of Range.\n"); } } void INV(int i) { if (i>5) { printf ("Incorrect Number of Values.\n"); } } int main (int argc, char**argv) { #define RETURN '\n' int array[5]; int c; int i; int choose; printf ("Please enter dice values:\n>"); i=0; c=0; while ((array[c]=getchar()) != RETURN) { c++; i++; } printf ("\nyour dice values are: %d %d %d %d %d\n\n", array[0], array[1], array[2], array[3], array[4]); IIF(array[5]); OOR(array[5]); INV(i); printf ("Please choose:\n1 ->Reroll some dice\n2 ->Reroll all dice\n3 ->Keep dice\n>"); scanf ("%d", &choose); if (choose=='2') { printf ("Please enter dice values:\n>"); i=0; c=0; while ((array[c]=getchar()) != RETURN) { c++; i++; } IIF(array[5]); OOR(array[5]); INV(i); } if (choose=='1') { printf ("Please enter dice to reroll (1-5):\n>"); scanf ("%d", &i); printf ("please enter 1 dice value:\n>"); scanf ("%d", &array[i]); IIF(array[0]); OOR(array[0]); } if (choose=='3') { } return (0); }