423,473 Members | 2,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,473 IT Pros & Developers. It's quick & easy.

Hey all I am getting the compiler Identifier Expected on the following code.

P: 1
#include<iosteram.h>
#include<conio.h>
class ex
{
int a,b,total;
public:
void gtdt();
void calc();
void disp();
};
ex::void gtdt()
{
cout<<"enter the value for a & b\n";
cin>>a>>b;
}
ex::void calc()
{
total=a+b;
}
ex::void disp()
{
cout<<total;
}
void main()
{
clrscr();
ex ob;
ob.gtdt();
ob.calc();
ob.disp();
getch();
}
Jun 9 '18 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,180
Your member functions are void ex::gtdt() and not ex::void gtdt().
Jun 9 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.