Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int checkAns(char c)
- {
- switch (c){
- case 'y':
- return 1;
- break;
- case 'n':
- return 0;
- break;
- default:
- printf("INVALID OUTPUT\n");
- exit(404);
- }
- }
- int main()
- {
- char ans;
- printf("Do you have a fever? ");scanf(" %c", &ans); //Q1
- if (checkAns(ans)){
- printf("Do you have a sore throat and headache-without nasal drainage? ");scanf(" %c", &ans); //Q2
- if (checkAns(ans)){
- printf("STREP THROAT\n");
- }else{
- printf("Did your symptoms start suddenly, and do you have a combination of symptoms including muscle aches, chills, a sore throat, runny nose or cough? ");scanf(" %c", &ans); //Q3
- if (checkAns(ans)){
- printf("FLU\n");
- }else{
- printf("Do you have a runny and/or itchy nose, sneezing, and itchy eyes? ");scanf(" %c", &ans); //Q4
- if (checkAns(ans)){
- printf("ALLERGIES\n");
- }else{
- printf("Do you have sneezing, a sore throat, headache, congestion and a runny nose? ");scanf(" %c", &ans); //Q5
- if (checkAns(ans)){
- printf("COLD\n");
- }else{
- printf("Call Your Doctor\n");
- }
- }
- }
- }
- }else{
- printf("Do you have a runny and/or itchy nose, sneezing, and itchy eyes? ");scanf(" %c", &ans); //Q4
- if (checkAns(ans)){
- printf("ALLERGIES\n");
- }else{
- printf("Do you have sneezing, a sore throat, headache, congestion and a runny nose? ");scanf(" %c", &ans); //Q5
- if (checkAns(ans)){
- printf("COLD\n");
- }else{
- printf("Call Your Doctor\n");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement