cout<<"do u wanna create an object ?"<<endl;
cin>>a
if(a==1) { ??????????????????????? }
You missed a semicolon there at the end of the second line, and that big stack of question marks doesn't look right. What exactly are you trying to do? If you want to create an object in there, how about this?
1 2 3
cout<<"do u wanna create an object ?"<<endl;
cin>>a;
if(a==1) { int x; }
That will create an int object (which will be deallocated very shortly afterwards, but if all you want to do is create an object, that will do it.
you didn't understand my question , srry for my bad english :D
here is the source code :
1 2 3 4 5 6 7 8 9
#include <iostream>
usingnamespace std;
class A
{...............................};
int main()
{ cout<<"do u wanna create an object ?"<<endl;
cin>>a;
if(a==1) { i don't know what to do here }
}
i know about dynamic allocation , but that's not what i want :)