Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program.
void main()
{
cout<<"Enter an Alphabet:" ;
cin>>CB ;
switch(CH)
case 'A' · cout<<"Ant"; Break ;
case 'B' · cout<<"Bear"; Break;
}
Advertisement Remove all ads
Solution
void main()
{
cout<<"Enter an Alphabate:";
cin>>CH;
switch(CH)
{
case :'A' cout<<"Ant"; Break;
case :'B' cout<<"Bear: ; Break;
}
}
Concept: Concept of Object Oriented Programming in C++
Is there an error in this question or solution?
Advertisement Remove all ads
APPEARS IN
Advertisement Remove all ads
Advertisement Remove all ads