i have written the program but my month function is making problem plz chk it and correct it

#include <iostream>
#include <stdlib.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
using namespace std;



      class expense
      {
	    private:
		    int income;
		    int gbill;
		    int ebill;
		    int wbill;
		    int oexpense;
		    string month[20];

		    public:

		    expense()
		      {  income=0;
			 ebill=0;
			 wbill=0;
			 gbill=0;
		      }
			   expense(int,int, int, int);
			   void display();
			   void saving();
			   void setTotalIncome();
			   void setOexpenses();
			   void setEBill();
			   void setWBill();
			   void setGBill();
			   void setmonth();
			   void setoexpense();
			   void Add_expense();
			   int getOexpenses();
			   int getEBill();
			   int getWBill();
			   int getGBill();
			   string getMonth();
			   
               ~expense()
			   {
			   }


			   };


void expense::saving()     // Saving----------------------
 {
    int save;
    save=income-(ebill+wbill+gbill);
    if(save<=0)
      cout<<"\nNo saving";
    else
      cout<<"Saving: "<<save;
 }
void expense::display()  //display-------------------------
{    cout<<"\n---- Display Expenses------ \n";

     cout<<"\n\nTotal Income:     "<<income;
     cout<<"\n\nElectric Bill:  "<<getEBill();
     cout<<"\n\nGas Bill:       "<<getGBill();
     cout<<"\n\nWater Bill:     "<<getWBill();
     cout<<"\n\nOther Expenses: "<<getOexpenses();
     cout<<"\n\nMonth in alphabets:          "<<month;

}

void expense::Add_expense() // add Expenses------------------
{
    setTotalIncome();
    setEBill();
    setGBill();
    setWBill();
    setOexpenses();
    setmonth();
}
void expense::setmonth()
{
   cout<<"\n Enter the Month: ";
   getMonth();
}
void expense::setTotalIncome()
{    cout<<"\nEnter the Total Income: ";
     cin>>income;
}
void expense::setEBill()
{    cout<<"\nEnter the Electric Bill: ";
     cin>>ebill;
     }
void expense::setGBill()
{
     cout<<"\nEnter the GasBill: ";
     cin>>gbill;
     }
void expense::setWBill()
{
     cout<<"\nEnter Water Bill: ";
     cin>>wbill;
     }
void expense::setOexpenses()
{     cout<<"\nEnter Other Expenses amount: ";
      cin>>oexpense;
}

/////////////////////////////////////////////////////
int expense::getEBill()
{
     return ebill;
}
int expense::getGBill()
{
     return gbill;
     }
int expense::getWBill()
{
     return wbill;
	    }
int expense::getOexpenses()
  { return oexpense;
  }

int main()
{  
expense m1;
int choice;
char ch='n';
do{

cout<<"\n\t Menu\n\n";
cout<<"\n\t 1. Add Expenses ";
cout<<"\n\t 2. Display Expenses";
cout<<"\n\t 3. Display Saving";
cout<<"\n\nEnter the Choice............. ";
cin>>choice;
switch(choice)
{  case 1:
    m1.Add_expense();
    break;
   case 2:
    m1.display();
    break;
   case 3:
       m1.saving();
       break;
}
cout<<"\n\n\tWant to continue[enter y]..............";
cin>>ch;
}
while(ch=='y');

    getch();

}

>>void expense::setmonth()
{
cout<<"\n Enter the Month: ";
getMonth();
}

Change to :

void expense::setmonth(std::string month){
  currentMonth= month;
}

I am not sure what your class does exactly but general idea is given above.

<deleted> what ^^^ said

its still giving error i want to display month name in character

its still giving error i want to display month name in character

Post the error message.

#include <iostream>
#include <stdlib.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
using namespace std;



      class expense
      {
	    private:
		    int income;
		    int gbill;
		    int ebill;
		    int wbill;
		    int oexpense;
		    string month[20];

		    public:

		    expense()
		      {  income=0;
			 ebill=0;
			 wbill=0;
			 gbill=0;
		      }
			   expense(int,int, int, int);
			   void display();
			   void saving();
			   void setTotalIncome();
			   void setOexpenses();
			   void setEBill();
			   void setWBill();
			   void setGBill();
			   void setmonth();
			   void setoexpense();
			   void Add_expense();
			   int getOexpenses();
			   int getEBill();
			   int getWBill();
			   int getGBill();
			   string getMonth();
			   string currentmonth;
               ~expense()
			   {
			   }


			   };


void expense::saving()     // Saving----------------------
 {
    int save;
    save=income-(ebill+wbill+gbill);
    if(save<=0)
      cout<<"\nNo saving";
    else
      cout<<"Saving: "<<save;
 }
void expense::display()  //display-------------------------
{    cout<<"\n---- Display Expenses------ \n";
     string currentmonth;
     cout<<"\n\nTotal Income:     "<<income;
     cout<<"\n\nElectric Bill:  "<<getEBill();
     cout<<"\n\nGas Bill:       "<<getGBill();
     cout<<"\n\nWater Bill:     "<<getWBill();
     cout<<"\n\nOther Expenses: "<<getOexpenses();
     cout<<"\n\nMonth in alphabets:          "<<month;

}

void expense::Add_expense() // add Expenses------------------
{
    setTotalIncome();
    setEBill();
    setGBill();
    setWBill();
    setOexpenses();
    setmonth();
}

  void expense::setMonth(std::string month)
  {
         currentMonth= month;
  }



void expense::setTotalIncome()
{    cout<<"\nEnter the Total Income: ";
     cin>>income;
}
void expense::setEBill()
{    cout<<"\nEnter the Electric Bill: ";
     cin>>ebill;
     }
void expense::setGBill()
{
     cout<<"\nEnter the GasBill: ";
     cin>>gbill;
     }
void expense::setWBill()
{
     cout<<"\nEnter Water Bill: ";
     cin>>wbill;
     }
void expense::setOexpenses()
{     cout<<"\nEnter Other Expenses amount: ";
      cin>>oexpense;
}

/////////////////////////////////////////////////////
int expense::getEBill()
{
     return ebill;
}
int expense::getGBill()
{
     return gbill;
     }
int expense::getWBill()
{
     return wbill;
	    }
int expense::getOexpenses()
  { return oexpense;
  }

int main()
{  
expense m1;
int choice;
char ch='n';
do{

cout<<"\n\t Menu\n\n";
cout<<"\n\t 1. Add Expenses ";
cout<<"\n\t 2. Display Expenses";
cout<<"\n\t 3. Display Saving";
cout<<"\n\nEnter the Choice............. ";
cin>>choice;
switch(choice)
{  case 1:
    m1.Add_expense();
    break;
   case 2:
    m1.display();
    break;
   case 3:
       m1.saving();
       break;
}
cout<<"\n\n\tWant to continue[enter y]..............";
cin>>ch;
}
while(ch=='y');

    getch();

}

error is
85 C:\Dev-Cpp\so.CPP no `void expense::setMonth(std::string)' member function declared in class `expense'
C:\Dev-Cpp\so.CPP In member function `void expense::setMonth(std::string)':
86 C:\Dev-Cpp\so.CPP `currentMonth' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)

You need to add currentMonth to your private variables list up in the declaration. You currently have string month[20]; which is giving you an array of 20 strings.
So either change "currentMonth" to "month" in your setMonth method or declare currentMonth up with the other private variables and delete string month[20] (the latter is probably the best).

You have no method getMonth() defined, you just have it declared.

Also, it's a little confusing to us when you make 3 different posts as people are recommending solutions on all of them and you're not incorporating them in each version. It's nice to want to split it up by topic but IMO makes it less organized when dealing with the same piece of code.

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.