注册 登录
编程论坛 C++教室

error C2064: term does not evaluate to a function

cancerhd 发布于 2007-08-02 15:37, 1612 次点击
只有本站会员才能查看附件,请 登录

7 回复
#2
medicihophy2007-08-02 15:53
我看了你的程序,你类的设计都有点问题!
#3
cancerhd2007-08-02 15:59

你有qq么,联系的方便点

#4
medicihophy2007-08-02 16:00

#include<iostream>
using std::cout;
using std::endl;
class Time
{
public:
Time();
void setTime(int ,int, int);
void printMilitary();
void printStandard();

private:
int hour;
int minute;
int second;


};
Time::Time()
{
hour = minute = second = 0;
}

void Time::setTime(int h,int m,int s)
{
hour = (h >= 0 && h <= 24)?h:0;
minute = (m >= 0 && m<= 60)?m:0;
second = (s >= 0 && s<= 60)?s:0;
}

void Time::printMilitary ()
{
cout<<(hour < 10 ?"0" :" ")<<hour<<":"
<<(minute < 10 ?"0" :" ")<<minute;

}

void Time::printStandard ()
{
cout<<((hour == 0 || hour ==12 ) ?
12 : hour & 12)
<<":"<<(minute < 10 ? "0" : " ")<<minute
<<":"<<(second < 10 ? "0" : " ")<<second
<<(hour < 12 ? "AM" : "PM");
}

int main()
{
Time t;

cout<<" the initial military time is: ";
t.printMilitary();
cout<<"the initial standard time is: ";
t.printStandard();

t.setTime(13,27,6);
cout<<"\n\n Military time after setTime is: ";
t.printMilitary();
cout<<"the standard time after setTime is: ";
t.printStandard();

t.setTime(99,99,99);
cout<<"\n\n after attempting invalid setting: "
<<"\n military time:";
t.printMilitary();
cout<<"\nstandard time:";
t.printStandard();
cout<<endl;

return 0;
}
这是改后的,你自己再分开!

#5
medicihophy2007-08-02 16:01
说你的吧,我加你
#6
cancerhd2007-08-02 16:05
283699636
#7
cancerhd2007-08-02 16:37
分开了还是有错误呀。
#8
medicihophy2007-08-02 16:38
把你分开的再发出来
1