MENU
Question -

cin>>r;
a=PI*pow(r,2); 
cout<<"Area="<<a;
}

' href='chapter-1-c-plus-plus-revision-tour-solutions-5.aspx'>
Rewrite the following C++ program after removing all the syntactical errors (if any),
underlining each correction :

includeciostream.h>
#define PI=3.14
void main()
float r,a;
cout<<'enter any radius'; 
cin>>r;
a=PI*pow(r,2); 



Answer -

#include // Error 1: Declaration Sytax error 
#include
#define PI=3.14      // Error 2: Macro declaration does not allow assignment 
void main()
{
float r,a;     // Error 3:Undefined Symbol a
cout<<"enter any radius";     //Error 4 : Character Constant
must be one or two characters long 
cin>>r;
a=PI*pow(r,2)   //Error 5 : Expression Syntax
cout<<"Area="<
}

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×