Saturday, June 6, 2009

Monthly Expenses program in C

Monthly Expenses program in C (Source Code)

Here is a simple program to prepare your monthly budget. For simplicity, I suggest to have the following income

  • Salary
  • Rent received
  • Others (may include any other sources of income)
We will have the following recurring expenses

  • House Rent
  • Electricity (PUB)
  • Telephone
  • Education-Kids
  • Education-Self
  • Medical
  • Insurance

Now the problem is to find the surplus/deficit for the particular month is given below:

#include <>
#include <>
void main()
float nSalary, nRentRec, nOtherIn;
float nRentPaid, nPUB, nTele, nEdKid, nEdSelf, nMed, nInsur;
float nInTotal, nExTotal, nBalance;
cout<<"Monthly Expenses Vs Income\n";
cout<<"Salary :";cin>>nSalary;
cout<<"Rent Received :";cin>>nRentRec;
cout<<"Other Income :";cin>>nOtherIn;
cout<<"Rent Paid :";cin>>nRentPaid;
cout<<"Public Utility :";cin>>nPUB;
cout<<"Telephone :";cin>>nTele;
cout<<"Education-Kids :";cin>>nEdKid;
cout<<"Education-Self :";cin>>nEdSelf;
cout<<"Medical :";cin>>nMed;
cout<<"Insurance :";cin>>nInsur;
nInTotal = nSalary + nRentRec + nOtherIn;
nExTotal = nRentPaid + nPUB + nTele
+ nEdKid + nEdSelf + nMed + nInsur;
nBalance = nInTotal - nExTotal;
cout<<"\nTotal Income : "<<><<"\nTotal Expenses : "<<>
if (nBalance<0)
cout<<"\nDeficit : ";
cout<<"\nSurplus : ";


Introduction to this blog

Dear Krishnan,

Thanks a lot. I dedicate this blog to you. You are my well wisher, mentor and friend.

Dear Friends,

I created this blog to share my knowledge in C and C++ with like minded people. I planned the posts in this blog in the following structure

blogpost {
choose a simple task
explain procedure/algorithm to solve the task
write the code for basic functionality
list some enhancements
ask the friends to solve them
discuss the friends' solution

There may be a discussion of few preliminary concepts for each post.

I assure you my response to your comments. In deed I must thank you in advance for your comments