You work for a company which mainly trades with 3 other companies. You record your balance in a file (you can still use cin or scanf to read or if you want you can read from "input.txt" file) with the following convention:

Debit of Company A
Credit of Company A
Debit of Company B
Credit of Company B
Debit of Company C
Credit of Company C
Question: Write a program that is going to read debit/credit information for 3 companies. Then, it will find out for the following:

Total debts,
Total credits
The most debited company according to the balance
Input specification
You will be given an integer (n) the number of transactions where 0 ≤ n ≤ 2000. Then, in each of the following n lines you will be given 2 numbers :

Operation Code: an integer from 1 to 6 (where 1 means Debit of Company A, etc.)
The amount: a floating point number which is between 0 and one million
Output specification
Show the following information (floating point numbers with 2 digits precision):

Total debts,
Total credits
The most debited company: a char of (A or B or C)
Sample Input I
2 59
6 154
2 187
5 497
5 31.5
3 488
Sample Output I
1016.5 400 B
Explanation: The balance according to given information is:

Company Total Balance
A Debit 0 246
Credit 246
B Debit 488 -488
Credit 0
C Debit 528.5 -374.5
Credit 154
Then, the most debited company is B.

2 Years
Discussion Span
Last Post by happygeek

i have to do a programplease man please help me i have to give teacher after 1 hour


Well that's not good for you. We do not do your work for you. Show us what you have and what the problems you are having with it. Include any compiler errors as well.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.