Which of the following variable declarations are correct? If a variable declaration is not correct, give the reason(s) and provide the correct variable declaration. double conversion = 2.5; //Line 1char grade = 'B+'; //Line 2double 28.5 = num //Line 3string message = ''First C++ course'; //Line 4int age = 18 years; //Line 5int perfectSquare; //Line 6float x, y, decimal; //Line 7
Which of the following variable declarations are correct? If a variable declaration is not correct, give the reason(s) and provide the correct variable declaration.
double conversion = 2.5; //Line 1
char grade = 'B+'; //Line 2
double 28.5 = num //Line 3
string message = ''First C++ course'; //Line 4
int age = 18 years; //Line 5
int perfectSquare; //Line 6
float x, y, decimal; //Line 7
Trending now
This is a popular solution!
Step by step
Solved in 6 steps