show_simple_cxx

show_simple_cxx - CHAPTER 2 Simple C++ Programs March 28,...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CHAPTER 2 Simple C++ Programs March 28, 2008 Program Structure Initial Definitions and Conventions Calculate the Volume of a Box preprocessor directives int main() { variable declarations statements } // // This program computes the volume of a box // #include <iostream> using namespace std; int main() { /* Declare and initialize variables */ double length(20.75), width(11.5); double height = 9.5; double volume; /* Calculate volume. */ volume = length * width * height; /* Print the volume. */ cout "The volume is " volume endl; // Exit program. return 0; } Program Structure Initial Definitions and Conventions Calculate the Volume of a Box preprocessor directives int main() { variable declarations statements } // // This program computes the volume of a box // #include <iostream> using namespace std; int main() { /* Declare and initialize variables */ double length(20.75), width(11.5); double height = 9.5; double volume; /* Calculate volume. */ volume = length * width * height; /* Print the volume. */ cout "The volume is " volume endl; // Exit program. return 0; } Program Structure Initial Definitions and Conventions Calculate the Volume of a Box preprocessor directives int main() { variable declarations statements } // // This program computes the volume of a box // #include <iostream> using namespace std; int main() { /* Declare and initialize variables */ double length(20.75), width(11.5); double height = 9.5; double volume; /* Calculate volume. */ volume = length * width * height; /* Print the volume. */ cout "The volume is " volume endl; // Exit program. return 0; } Program Structure Initial Definitions and Conventions Calculate the Volume of a Box preprocessor directives int main() { variable declarations statements } // // This program computes the volume of a box // #include <iostream> using namespace std; int main() { /* Declare and initialize variables */ double length(20.75), width(11.5); double height = 9.5; double volume; /* Calculate volume. */ volume = length * width * height; /* Print the volume. */ cout "The volume is " volume endl; // Exit program. return 0; } Program Structure Initial Definitions and Conventions Calculate the Volume of a Box /* Comment */ // Comment /* Multiple Line Comment */ // Multiple // Line // Comment // // This program computes the volume of a box // #include <iostream> using namespace std; int main() { /* Declare and initialize variables */ double length(20.75), width(11.5); double height = 9.5; double volume; /* Calculate volume. */ volume = length * width * height; /* Print the volume. */ cout "The volume is " volume endl; // Exit program. return 0; } Program Structure Initial Definitions and Conventions Why Indent?...
View Full Document

Page1 / 36

show_simple_cxx - CHAPTER 2 Simple C++ Programs March 28,...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online