Ch2_2 - Next Previous Section 2.2: Running Programs Section...

Info iconThis preview shows pages 1–4. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Next Previous Section 2.2: Running Programs Section 2.2: Running Programs 11 Section 2.2: Running a C++ Program To solve a problem in a computer language requires five general steps: 1. Organizing the sequence of calculations needed to solve the problem 2. Writing the "code" for the problem in the respective computer language, generally termed a "program" 3. Using the compiler to convert the program into "machine language" that your computer understands 4. Debugging the program, to eliminate errors in the syntax and logic 5. Running the program, and viewing the results In this section we use simple C++ program examples to demonstrate the basics of how to use the Dev-C++ compiler to compile, debug, and run C++ programs Next Previous Section 2.2: Running Programs Section 2.2: Running Programs 22 Solving a problem The average of three numbers ave=(a+b+c)/3 Naming variables l a, b, c ? x, y, z ? first, second, third ? l numb_1, numb_2, numb_3? l C++ variables must start with a letter, can use numbers and underscore, but not blanks or special characters like & or $ l Variables are case sensitive l Recommend using lower case Variable types l Integers (int), float, double, char, logical (bool) Manipulating variables l Assignment Statements l Arithmetic Next Previous Section 2.2: Running Programs Section 2.2: Running Programs 33 The Code /* This program calculates the average of three values */ //Specifies that the standard namespace function library is to be used using namespace std;...
View Full Document

This note was uploaded on 05/19/2008 for the course ENGR 25 taught by Professor All during the Spring '08 term at Lehigh University .

Page1 / 18

Ch2_2 - Next Previous Section 2.2: Running Programs Section...

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

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