Hi,
I'm working with the Miracle C (unregistered version) compiler on the following assignment:-
"Construct a program that will input the name of a person and decide whether he/she is suspect to a crime. It has been reported that a person between 20 and 25 years old and between 66 and 70 inches tall committed the crime. The program should display the name of the suspect if they fit this description".
Inputting the following code the program compiles, builds and executes the program .. except that it only reads the first "if" statement i.e. "Is a suspect..." no matter what age or height I input. This is my code:
#include <stdio.h>
main()
{
char name;
int age;
int height;
printf ("Name of suspect:");
scanf ("%s",&name);
printf ("Age of suspect:");
scanf ("%d",&age);
printf ("Height of suspect:");
scanf ("%d",&height);
if (age >= 20,age)
if (age <=25,age)
if (height >= 66,height)
if (height <= 70,height)
printf ("Is a suspect and should be detained for questioning");
else
if (age <20,age)
if (age >25,age)
if (height <66,height)
if (height >70,height)
printf ("Is not a suspect and should be released");
}
If someone can put me on the right path I'd be very grateful,
Jude