Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- // function might take argument through it parameters, but that
- // depends on you. any how you want it.
- const int TWO_WEEKS = 10;
- const int TWO_THREE_WEEKS = 153;
- const int MAX_WEEKS = 2753;
- double get_hcg(){
- // intepreting from the ADC ( which is like a transducer from what you wrote)
- // a function called in a library will be handling that.
- // this is just the other logic part of it
- return 0.0; // return whatever is interpreted double literal or double variable
- }
- double get_threshold(){
- return 0.0; // which should what the threshold is, could be a variable or just double literal
- }
- int main()
- {
- double hcg_threshold = get_threshold();
- double hcg = get_hcg();
- while(hcg){ // depending if hcg holds a value or not, this loops runs otherwise false
- if(hcg < 5){
- printf();
- }
- else if (hcg > 6 && hcg < 24){
- printf();
- }
- else if (hcg >= 25){
- printf("Output: positive");
- if( hcg_threshold == 10){
- printf("Output: Less than 2 weeks ");
- }
- else if(hcg_threshold == TWO_THREE_WEEKS){
- printf("Output: Between 2 - 3 weeks")
- }
- else if(hcg_threshold == MAX_WEEKS){
- printf("Output: More than 3 weeeks");
- }
- else{
- printf("Output: Weeks Unknown");
- break;
- }
- }
- else
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement