Kevin321888999

Lab 6 part A 2

May 2nd, 2022 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>// standard library input out put
  2.  
  3.  
  4. double purchases( float Tabs[]){return
  5.   printf("When prompted, enter an ID# and price for one purhase:\n ");
  6.   }
  7. double bills(float Tabs,double price){
  8.   return printf("Mothly snack bar bill for ID# %.0f: %lg \n",Tabs, price);
  9.   }
  10.  
  11.  
  12. int main(void) {
  13. double price;
  14. double ID;
  15. int counter=0;
  16.  
  17. float Tabs[7]={0,1,2,3,4,5,6};
  18. purchases(Tabs);
  19.  
  20. for(;;){
  21. scanf("%lg",&ID);
  22. if(ID>=0&&ID<=6){
  23. scanf("%lg",&price );
  24. counter++;
  25. if(price<0.0){printf("Data set is ignored; The price must be > 0.0\n");counter-=1;break;}
  26. }
  27. else{break;}}//the else statement will
  28. printf("%i purchases were entered\n",counter);
  29.  
  30.  
  31. for(int i=0;i<=6;i++){
  32. bills(Tabs[i],price);
  33. }
  34.  
  35.   return 0;
  36. }
Add Comment
Please, Sign In to add comment