trying to write a program with a switch statement which is a type of guessing game. new to c. The program contains a stored variable and the user will have to input the number and a switch statement will be prompting higher and lower. I have managed to make a skeleton program and it compiles. but it just does nothing when the number is input.
any help would be great !
Code:
#include <stdio.h>
#include "/Volumes/Macintosh HD/csci1401.h"
main()
{
int i,n,a;
printf("Enter a number\n"); n = getInt();
a=7;
if (a==n)
{
printf("You have guessed the right answer 7 \n");
}
else
{
switch(a)
{
case 0: n>7; printf("Lower"); break;
case 1: n<7; printf("higher"); break;
default:n==7;printf("you have guessed rite");
}
}
}