elements of a c++ program 1. review algorithms describe how to solve a problem structured english...

Post on 11-Jan-2016

215 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Chapter 2

FunctionA C++ program is a collection of one or more functions (subprograms).Each function does some specific task in order to solve the problem.

There must be a function called main()Execution always begins with the first statement in function main()Any other functions in your program are subprograms and are not executed until they are called

Try helloWorldAmerica.cpp5The output statement: coutbegins with coutendl means end of the line. (same as \n)It moves the cursor to the next line of the displayIt does not have to be the last thing in a cout statementeach thing (literal, variable, endl) is preceded with

top related