help me with this kind of program,i have tried to declare those variables but it continues to say u ndeclared identify CBDA

#include<iostream>
using namespace std;
int main()
{
	
	 float catergory A; 
	 float catergory B; 
	 float catergory C; 
     float catergory D;

	const float Catergory of pair A = -999,99;
	const float catergory B = 750,89;
	const float catergory C = 500,00;
	const float catergoy  D = 268,77;

return 0;
}

Recommended Answers

All 4 Replies

Try this. I fixed it and it ran fine for me

#include<iostream>
using namespace std;
int main()
{

	 float catergory_A;
	 float catergory_B_number1; // no spaces inbetween words when declaring data types
	 float catergory_C_number1; // same error here as above
     float catergoryD;

	const float Catergory_of_pair_A = -999.99; // same error as above plus you had commas instead of decimals for everything below this point
	const float catergory_B = 750.89;
	const float catergory_C = 500.00;
	const float catergoy_D = 268.77;

return 0;
}

you had two things set to two different values so it gave an error. plus you cant have spaces in between declarations i used _ and it compiled fine. also you had commas instead of periods for the decimals. You can changed the number_ to whatever you want just dont have spaces in between words when declaring it as a data type

i want to use switch to my program please show me how to use it

clear some errorrs

#include<iostream>
using namespace std;
int main()
{

	 double catergory_A;
	 double catergory_B_number1;
	 double catergory_C_number1;
     double catergoryD;

	double Catergory_A = 999.99; 
	double catergory_B = 750.89;
	double catergory_C = 500.00;
	double catergoy_D = 268.77;
	char catergories;
	{
	switch (catergories)
	{
	case 'A':
		double price += Catergory_A;
			
			break;
	case 'B':
				 price += catergory_B;
				break;
	case 'C':
		 price += catergory_c;
			break;
	case 'D':
		 price +=catergory_D;
			break;
	}
	
	}



return 0;
}
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.