Kevin321888999

Lab 6 part A

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