Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>// standard library input out put
- double purchases( float Tabs[]){return
- printf("When prompted, enter an ID# and price for one purchase:\n ");
- }
- double bills(float Tabs){
- return
- printf("Mothly snack bar bill for ID# %.0f: \n",Tabs);
- }
- int main(void) {
- double price;
- double ID;
- int counter=0;
- float Tabs[7]={price};
- purchases(Tabs);
- for(;;){
- printf("Enter the ID# and the price: \n");
- scanf("%lg",&ID);
- if(ID>=0&&ID <=6){//Checks if the ID>=0 and <=6. Then passes it to the price.
- scanf("%lg",&price );
- counter++;//if successful, it counts the number of purchases made by the accounts.
- 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.
- }
- else{break;}}//the else statement will decrement by default if the ID number exceeds the boundaries set by the
- printf("%i purchases were entered\n",counter);
- for(int i=0;i<=6;i++){
- bills(Tabs[6]);
- Tabs[6]++;}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment