C++ need help

closed account (2zU7fSEw)
Hello everyone,
I am new in programmer and i real need your help for the following question. Thank you for your time.*************** Write a program that calculates how much money you are spending on average per day in a week. The program will calculate the total average, as well as the average of what you spend in the following categories: food, clothing, school-related expenses, and outside entertainment. You will ask the user how much he/she spends in each category for each day and keep a running total for each category. Use static variables to keep track of these amounts, as you will revisit a function containing the loop structure(s) for each day. You will also need an average function that calculates all of the averages. Organize the main program to call input and output functions. The input function will be responsible for updating the totals, and the output function will calculate and display the results. Note that these functions will most likely call other functions to accomplish tasks. Use value and reference parameters as necessary.
What have you done so far? You should get started by yourself, we'll help you with problems you encounter.

Read these and get started -

http://www.cplusplus.com/doc/tutorial/basic_io/
http://www.cplusplus.com/doc/tutorial/functions/
http://www.tutorialspoint.com/cplusplus/cpp_loop_types.htm
http://www.cprogramming.com/tutorial/lesson2.html
Last edited on
closed account (2zU7fSEw)
Thank you. Can you check the following codes please? Be blessed.
#include <iostream>
using namespace std;
void getscore(int food, int clothes, int school, int entertain);
void calcaverage(double food, double clothes, double school , double entertain);
int main()
{
static int food; static int clothes; static int school; static int entertain;

cout << "Average out your spending day!\n";
getscore(food, clothes, school, entertain);
cout << "So just to clarify: " << endl;
cout <<food << clothes <<school<< "&"<<entertain << endl;
cout << "Your total average for all of your expenses is: ";
calcaverage(food, clothes, school, entertain);
cout << food << clothes << school << entertain<< endl;
system ("pause");
return 0;
}

void getscore(static int food, static int clothes, static int school, static int entertain)
{
cout<< "Enter the amount you spend on food each day ";
cin >> food;
cout<< "Enter the amount you spend clothes each day ";
cin >> clothes;
cout<<"Enter the amount you spend on school-related expenses each day ";
cin >> school;
cout<<"Enter the amount you spend on outside entertainment each day ";
cin >> entertain;
}
void calcaverage(double food, double clothes, double school , double entertain)
{
cout <<"Total average for all of your expenses is: "<< (food+clothes+school+entertain) / 4 << endl;
cout <<"Enjoy the remainder of your day"<<endl;

}
Last edited on
Topic archived. No new replies allowed.