Creating a C++ Program: Preprocessor Directives, Syntax, and Function main, Assignments of Computer Science

The process of creating a c++ program, including the role of preprocessor directives, the structure of the program with a focus on the function main, and the syntax of declaration and executable statements. Students in csci 152 (programming fundamentals ii) during summer 2008 will find this information essential for completing assignment #1.

Typology: Assignments

Pre 2010

Uploaded on 08/16/2009

koofers-user-elk
koofers-user-elk 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCI 152
Programming Fundamentals II
Summer 2008
Assignment #1
Creating a C++ Program
June 5, 2008
pf3
pf4
pf5

Partial preview of the text

Download Creating a C++ Program: Preprocessor Directives, Syntax, and Function main and more Assignments Computer Science in PDF only on Docsity!

CSCI 152

Programming Fundamentals II

Summer 2008

Assignment

Creating a C++ Program

June 5, 2008

Creating a C++ Program

  • C++ program has two parts:
    1. Preprocessor directives
    2. The program
  • Preprocessor directives and

program statements constitute

C++ source code

  • Source code must be saved in a

file with the file extension .cpp

Program Style and Form

 The Program Part

 (^) Every C++ program has a function main  (^) Basic parts of function main are:  (^) The heading  (^) The body of the function 

The heading part has the following

form

Body and Syntax

 (^) The body of the function is enclosed between { and }  (^) Has two types of statements  (^) Declaration statements  Executable statements  (^) Errors in syntax are found in compilation int x; //Line 1 int y //Line 2: syntax error double z; //Line 3 y = w + x; //Line 4: syntax error