what is the mistake.
Please tell me what is the mistake in this code,it seems correct to me but it is giving some error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include<iostream>
using namespace std;
class clock{
public:
void setTime(int hr, int min,int sc);
private:
int hour;
int mint;
int sec;
};
void clock::setTime(int hr,int min,int se)
{
hour=hr;
mint=min;
sec=se;
}
int main()
{
clock myclock;
myclock.setTime(3,45,52);
cout<<"\n";
system("pause");
return 0;
}
|
What error is it giving? I don't see any problems with the code at first glance.
expected ; before myclock is shown by the compiler.
It may be because your compiler is thinking you are using the clock functions from the ctime library. Try renaming your class to something else.
Thanks dude. Now Working.
Topic archived. No new replies allowed.