Question: #include using namespace std; int main ( ) { / / Calculate area and volume of a cube double Height = 3 . 0 double

#include
using namespace std;
int main()
{
// Calculate area and volume of a cube
double Height =3.0
double Area =8* Height * Height;
double Volume = Height * Height;
// Print results
cout << "Height ="<< Height <<"
";
cout << "Area =<< Area <<
";
cout << "Volume =" Volume "
";
return 0;
}
Step 1: Create a C++ program called "cube.cpp", and use cut and paste to copy the text above into this file. Now compile this program. You should see several error messages telling you where the syntax is incorrect. Most C++ compilers will tell you the line number where an error has occurred and some sort of cryptic message explaining what is wrong. Sometimes these are meaningful, and other times they are very confusing.
Step 2: For the code above, the first error message should be something like: cube.cpp:8: error: expected ',' or ';' before 'double'. This is because we forgot the semicolon at the end of line 7. Add the missing semicolon and recompile the program. Hopefully you have a different message now. The actual error will be at or slightly above the specified line number.
Step 3: Start entering your corrections to make the compiler errors go away. As a general rule, it is best to start with the first error message and recompile until that error is corrected. For major corrections, make a comment near the code you corrected so you can remember what you did. These comments are very important when you work on joint programming projects so everyone can keep track of changes to the code by reading the comments.
Step 4: Once the compilat

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!