Plz help me. I am unable to understand this problem statement. Can Plz someone help me?


Problem Statement: File Handling in C/C++
On the basis of the given scenario create a file Expenses.txt, Open the file and copy into another Expenses2.txt, Also show output on screen
A college has announced the total budget of 50,000Rs.for each game. Games are done four times in a year. Take expenses as an input from user.
Calculate the average expenses for a game:

1. If the expenses greater than 80% show as” Very Expensive”.
2. If the expenses are greater than 60% and less than 80% than show “Expensive ”
3. If the expenses are greater than 50% and less than 60% than show “Less Expensive ”
4. If the expenses are greater than 40% and less than 50% than show “Not Costly”.
5. If the expenses are less than 40% than show “Best”.

Recommended Answers

All 2 Replies

Wow that is one crazy problem and and be probably interpreted a few different ways.

The way I read it is
1) get 4 expense values from the user ( because they have 4 games a year)

2) get the average of the 4 expenses ( so add the for values you got and divide by 4)

3) write the 4 expenses into a text file Expenses.txt ( basically a test to see if you can write to a file)

4) copy the data in that text file you just wrote into another text file Expenses2.txt ( basically a test to see if you can copy from a file )

5) check to see the % of the average of expenses typed by the user in comparison to the money given for 1 game. (so 50,000/(average expense)

6) then use that % and print to the console:
1. If the expenses greater than 80% show as” Very Expensive”.
2. If the expenses are greater than 60% and less than 80% than show “Expensive ”
3. If the expenses are greater than 50% and less than 60% than show “Less Expensive ”
4. If the expenses are greater than 40% and less than 50% than show “Not Costly”.
5. If the expenses are less than 40% than show “Best”.

Depending on the % you got

That's what I got from reading the problem, but I would double check with your professor to see if that is what they want. And ask them if they could rewrite their assignments so that they are more easily understood. I would hate to take a final exam where all the questions were written out like that looooooool!

Thanks thats was quite helping for me. You are really good. It was very difficult statement to understand but you made it clear. Now i will try to write my code and i will show you on this forum.

If someone have more ideas about this statemnt, so plz share it. I think this is a quite complex problem. So plz share your ideas.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.