First off, congratulations. I don't know how you got that to compile, so you must have some serious compiling skills.
In the more likely even that you're using a compiler that lets you get away with weird stuff, it's probably because you should declare your variables like this:
Code:
//No!!
int i, float j;
//Good
int i;
float j;
The top one, for whatever reason, is allowing you to declare improperly, and it thinks you are declaring two ints (my guess). Because you can actually declare two ints like this
and I guess some compilers will let you stretch that to a weird extreme?
Anyhoo, this will work
Code:
#include<iostream>
class ex
{
int i;
float j;
public:
ex(int ii,float jj)
{
i=ii; j=jj;
}
void display()
{
std::cout<<i<<std::endl<<j<<std::endl;
}
};
int main()
{
ex e(5,10.2);
e.display();
return 0;
}