# include <stdio.h>
#include <stdlib.h>
int option();
int questions ();
int count_yes ();
int main ()
{
questions ();
option ();
medcode();
}
Printf("Are you an asthma patient?\n");
Scanf("%s", &option);
if option='N'
{
Printf ("You are not an asthma patient. Goodbye.");
}
else option='Y'
{
while option= Y
{
Int question ()
{
Char* answer [6]; / int x=0;
Printf ("Welcome to Omega Medical!\n")
Printf ("Please enter medication code prescribed.\n");
Scanf ("%s",&medcode);
Printf ("Enter Y for yes and N for no.\n");
Printf ("Do you have shortness of breath?\n");
Scanf ("%s", &answer [x]);
x++;
Printf ("Do you have chest pain?\n");
Scanf ("%s", &answer [x]);
x++;
Printf ("Do you have difficulty breathing?\n");
Scanf ("%s", &answer [x]);
x++;
Printf ("Have you ever had a bronchiatric infection?\n");
Scanf ("%s", &answer [x]);
x++;
Printf ("Do you smoke?\n");
x++;
Printf("Do you have a family history of asthma?\n");
Scanf("%s", &answer[x]);
x++;
}
Int count_yes ()
{
Int j, count_yes=0;
For (j=0; j<=5; j++) {
If (answer[j] =='Y') {
count_yes=count_yes + 1;
}
}
}
Return count_yes();
Struct Medicine
{
Int ID;
};
Struct medicine controller1;
Struct medicine controller2;
Struct medicine reliever3;
Struct medicine reliever4;
controller1.ID=0001;
controller2.ID=0002;
reliever3.ID=0003;
reliever4.ID=0004;
If count_yes<=2
{
Printf("You require a controller.\n");
If yes_count=1
{
Printf("Medication ID required:", controller1.ID);
}
If yes_count=2
{
Printf("Medication ID required:", controller2.ID);
}
}
If (count_yes>=3) and (count_yes<=4)
{
Printf ("You require a reliever.\n")
If count_yes=3
{
Printf ("Medication ID required:", reliever3.ID);
}
If count_yes=4
{
Printf ("Medication ID required:", reliever4.ID);
}
}
If count_yes>4
{
Printf ("Patient needs immediate medical attention; please see closest health care facility.");
}
Printf(" Best Wishes! from Omega Medical.");
End while
}
Sade' 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.