Advertisement
Fourteen98

To_Naz

Jun 3rd, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. // function might take argument through it parameters, but that
  5. // depends on you. any how you want it.
  6. const int TWO_WEEKS = 10;
  7. const int TWO_THREE_WEEKS = 153;
  8. const int MAX_WEEKS = 2753;
  9.  
  10. double get_hcg(){
  11.  // intepreting from the ADC ( which is like a transducer from what you wrote)
  12.  // a function called in a library will be handling that.
  13.  // this is just the other logic part of it
  14.  
  15.     return 0.0; // return whatever is interpreted double literal or double variable
  16.  
  17. }
  18.  
  19. double get_threshold(){
  20.  
  21.     return 0.0; // which should what the threshold is, could be a variable or just double literal
  22. }
  23.  
  24. int main()
  25. {
  26.     double hcg_threshold = get_threshold();
  27.     double hcg = get_hcg();
  28.     while(hcg){ // depending if hcg holds a value or not, this loops runs otherwise false
  29.         if(hcg < 5){
  30.             printf();
  31.         }
  32.         else if (hcg > 6 && hcg < 24){
  33.             printf();
  34.         }
  35.         else if (hcg >= 25){
  36.             printf("Output: positive");
  37.             if( hcg_threshold == 10){
  38.                 printf("Output: Less than 2 weeks ");
  39.             }
  40.             else if(hcg_threshold == TWO_THREE_WEEKS){
  41.                 printf("Output: Between 2 - 3 weeks")
  42.             }
  43.             else if(hcg_threshold == MAX_WEEKS){
  44.                 printf("Output: More than 3 weeeks");
  45.             }
  46.             else{
  47.                 printf("Output: Weeks Unknown");
  48.                 break;
  49.  
  50.             }
  51.         }
  52.         else
  53.             break;
  54.  
  55.     }
  56.  
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement