Hi , this pr. works with clases but someway it just throws me a error:

switch (atoi(i))//yes its an int 1,2,3,... etc...
		{
		case 1:
R S(r, h);//create new class R object named S,to constructor we give two     parameters
F * f1 = &S; //yess pointers polymorph....
		cout << "V = pr^2*h: " << fig1->t() << " m^3" << endl;
	        cout << "S=pr^2...: " << fig1->p() << " m^2" << endl;
		cout << endl;
		break;
		case 2://errorrr... so why & how to fix it
//error:jump to case label...
//error : crosses initialization of R

I'd be really happy if you could help me to solve this quickly :)

Hi , this pr. works with clases but someway it just throws me a error:

switch (atoi(i))//yes its an int 1,2,3,... etc...
		{
		case 1:
R S(r, h);//create new class R object named S,to constructor we give two     parameters
F * f1 = &S; //yess pointers polymorph....
		cout << "V = pr^2*h: " << fig1->t() << " m^3" << endl;
	        cout << "S=pr^2...: " << fig1->p() << " m^2" << endl;
		cout << endl;
		break;
		case 2://errorrr... so why & how to fix it
//error:jump to case label...
//error : crosses initialization of R

I'd be really happy if you could help me to solve this quickly

1. This is C++ code (such as it is). There are much better string to int conversions available than atoi

2. Use some more { }, like this

switch (atoi(i))//yes its an int 1,2,3,... etc...
		{
		case 1:
		[B]{[/B]
R S(r, h);//create new class R object named S,to constructor we give two     parameters
F * f1 = &S; //yess pointers polymorph....
		cout << "V = pr^2*h: " << fig1->t() << " m^3" << endl;
	        cout << "S=pr^2...: " << fig1->p() << " m^2" << endl;
		cout << endl;
		[B]}[/B]
		break;

Yeah, answered on the C board already. Don't cross-post (time-waster).

Works great thx, just a mistake when I posted it on c forum I saw that i WAS C FORUM !!!
but not c++ sryyyyy

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.