I'm doing a a program that converts time from 24 hours to 12 hours . I'm doing it using the constructor in class time 12 taking one argument which is of type class time 24 and making the conversion . I've got an error and I don't know where is the problem. Here is the constructor where the error occurs .

time12::time12(time24 t24)
{
	int hrs24=t24.getHrs();
	 pm = t24.getHrs()<12?false :true;     //find am / pm
	                                    // round seconds
	 min= t24.getSecs()<30? t24.getMins() :t24.getMins+1;
	if(min==60)                    //carry mins
	{
		min=0;
		++hrs24;
		if(hrs24==12 || hrs24==24)      //carry hrs
			pm=(pm==true)?false : true;  //toggle am/pm
	}
	hrs=(hrs24<13)?hrs24:hrs24-12;
	if(hrs==0)                   //o to 12 a.m
	{hrs=12;pm=false;}
	
}

there are two errors are for

min= t24.getSecs()<30? t24.getMins() :t24.getMins+1;

1)Error 1 error C3867: 'time24::getMins': function call missing argument list; use '&time24::getMins' to create a pointer to member c:\users\reem mandour\documents\visual studio 2008\projects\training5\training5\training5.cpp 113
2)Error 2 error C2296: '+' : illegal, left operand has type 'int (__thiscall time24:: * )(void) const' c:\users\reem mandour\documents\visual studio 2008\projects\training5\training5\training5.cpp 113


thank you
:)

well , I've found the error :) IT'S SOMETHING SIMPLE I don't know how I didn't notice it . getMins()+1
thank you

okay sure I'll show it to you although I've found the mistake and corrected it :)

class time24
{
	int hours;          //from 0 to 23
	int minutes;       //0 to 59
	int seconds;      //0 to 59
public:
	time24():hours(0) , minutes(0) , seconds(0)
	{    }
	time24(int h , int m , int s):hours(h) , minutes(m) , seconds(s)
	{    }
	void display()
	{
		if( hours<10)  cout<<'0';
		cout<<hours<<':';
		if( minutes<10)  cout<<'0';
		cout<<minutes<<':';
		if( seconds<10)  cout<<'0';
		cout<<seconds<<':';
		
		

	}
	//--------------------------------------------fuctions to access pvt members to be able make conv
	                                         //    using 1-arg constructor
         int getHrs()const   { return hours; }
		int getMins()const { return minutes; }
		int getSecs()const  { return seconds; }
	//----------------------------------
};
class time12
{
	bool pm;            //true=p.m , false=a.m
	int hrs;            //1 to 12
	int min;            //0 to 59
public:
	time12():pm(true) , hrs(0) , min(0)
	{    }
	//-------------
	time12(time24);//1-arg constructor that does the same job as convesion operator
	//-------------
	time12(bool ap , int h , int m):pm(ap) , hrs(h) , min(m)
	{  }
	 void display() const     //format :  11:59 p.m
	 {
		 cout<<hrs<<':';
		 if(min<10)
			 cout<<'0'; //extra 0 for "01"
		 cout<<min<<' ';
		 string am_pm = pm ? "pm" : "am";
		 cout<<am_pm;
	 }


};
time12::time12(time24 t24)
{
	int hrs24=t24.getHrs();
	 pm = t24.getHrs()<12?false :true;     //find am / pm
	                                    // round seconds
	 min= t24.getSecs()<30? 
		                    t24.getMins() :t24.getMins()+1;
	if(min==60)                    //carry mins
	{
		min=0;
		++hrs24;
		if(hrs24==12 || hrs24==24)      //carry hrs
			pm=(pm==true)?false : true;  //toggle am/pm
	}
	hrs=(hrs24<13)?hrs24:hrs24-12;
	if(hrs==0)                   //o to 12 a.m
	{hrs=12;pm=false;}
	
}
int main()
{
int h , m , s;
	while(true)
	{
		cout<<"Enter the 24 hours time: \n";
		cout<<"     Hours from (0 to 23) : "; cin>>h;
		if(h>23)    //quit if hours >23
			return(1);
		cout<<"minutes : ";cin>>m;
		cout<<"seconds : ";cin>>s;
		time24 t24(h,m,s);
		cout<<"you entered : ";t24.display();
		time12 t12=t24;
		cout<<"\n12-hour time: ";t12.display();
		cout<<"\n\n";
	}

}
This question has already been answered. Start a new discussion instead.