# 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

}

Recommended Answers

All 2 Replies

You'll want to tell the forum what you think is wrong but line 1 glares at me with that extra space after the # sign. Is that what you are seeing in the compiler errors?

About line 14 you see some basic coding issues. It seems you have your main() then main ends and you have code without a function(). Very bizarre.

  1. The curly brace on line terminates main(). Get rid of it.
  2. There is no "End while" (line 125) in C or C++. A while() loop will terminate with a curly brace.
  3. The while statement on line 22 should be while (option == 'Y') and you need to define option as a char type variable

There are other mistakes as well. This will get you started.

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.