Kevin321888999

lab 6 part A 3

May 7th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.13 KB | None | 0 0
  1.  
  2. #include <stdio.h>// standard library input out put
  3.  
  4.  
  5. double purchases( float Tabs[]){return
  6.   printf("When prompted, enter an ID# and price for one purchase:\n ");
  7.   }
  8. double bills(float Tabs){
  9.   return
  10.  
  11. printf("Mothly snack bar bill for ID# %.0f:  \n",Tabs);
  12.   }
  13.  
  14.  
  15.  
  16.  
  17. int main(void) {
  18. double price;
  19. double ID;
  20. int counter=0;
  21. float Tabs[7]={price};
  22. purchases(Tabs);
  23.  
  24. for(;;){
  25. printf("Enter the ID# and the price: \n");
  26. scanf("%lg",&ID);
  27.  
  28. if(ID>=0&&ID <=6){//Checks if the ID>=0 and <=6. Then passes it to the price.
  29. scanf("%lg",&price );
  30. counter++;//if successful, it counts the number of purchases made by the accounts.
  31. if(price<=0.0){printf("Data set is ignored; The price must be > 0.0\n");counter-=1;break;}//If the price is lower than or equal to 0 then the messgae will print out, will decrement the "purchases entered" by -1 because you do not want to include it.
  32. }
  33. else{break;}}//the else statement will decrement by default if the ID number exceeds the boundaries set by the
  34. printf("%i purchases were entered\n",counter);
  35.   for(int i=0;i<=6;i++){
  36. bills(Tabs[6]);
  37. Tabs[6]++;}
  38.  
  39.  
  40.  
  41.   return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment