This is my second time using the char variable so please forgive the silly question. How do I make this work? It's towards the bottom.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int inLoop = 0, outLoop = 0, input;
int numberOne, numberTwo;
char inputChar;
while (outLoop == 0) {
srand( time(NULL) );
while (inLoop == 0) {
numberOne = rand();
numberTwo = rand();
printf("What is %d times %d? ", numberOne, numberTwo);
scanf("%d", &input);
if (input == (numberOne * numberTwo) ) {
printf("Correct!\n");
inLoop = 1;
}
else
printf("Wrong, try again\n");
}
// --------------------------This is where the problem is occuring -------------------------------------------
while (inputChar != y && inputChar != Y && inputChar != n && inputChar != N) {
printf("Would you like to do another one(y or n)? ");
scanf("%c", &inputChar);
if (inputChar == y || inputChar == Y)
continue;
else if(inputChar == n || inputChar == N)
inLoop = 1;
else
printf("You can only enter y or n\n");
}
return 0;
}