Running your first C++ program in Borland C++



Introduction and basic C++ programming

Getting Started:

Attendance

Syllabus

Handouts – bloodshed c++ & turingscraft/codelab

Compiler – bloodshed c++ on my webpage url to download the free compiler.

Code Lab

Steps to enroll in and start using turning's craft

Go to the following address:



click on register

student

continue

your access code is CUN-BRO-6465-2210

university is CUNY-brooklyn

type in the email address you want to use (real)

select a password

enter your first and last names

accept the agreement

you are taken to the exercises

please start working on them – I will put up due dates

also, please let me know if the process works

High-level - Compiler Languages (closer to human languages – assembly low level – closer to machine language)

More English-like, more natural. Each high-level language statement translates to several low-level language statements. Use compilers to translate from the high-level language into machine language. Compilers translate the whole program first, then execute the object program.

A compiler language is a high-level language which is machine-independent.

High-level languages are more English-like, easier to code, more costly to run, less flexible. e.g., FORTRAN, BASIC, COBOL, PL/1, ALGOL, APL, Pascal, SIMSCRIPT, Smalltalk, C, C++, Java.

A compiler is a translator program that transforms high-level program code into a low-level machine-level executable program.

C++ Programming

Every programming language has facilities to: in C++

1. Read data from some input device cin >>

2. Write output information onto an output device cout

5. Perform logical operations ! && ||

6. Branch to a non-sequential instruction (w/wo structure) while

7. Store (and retrieve) data values to (and from) memory =

Homework

Running a simple C++ program in Bloodshed Dev-C++

Bloodshed Dev-C++ provides an integrated environment for writing programs. "Integrated environment" means Dev-C++ is a combination program, consisting of a text editor and a C++ compiler. A text editor is a limited word processing program that allows you to type in your program, make corrections and changes, and save and retrieve your program from disk storage. The editor is integrated with the Dev-C++ compiler so that you can easily switch between editing your program and compiling and running it. Note that the Dev-C++ compiler allows you to write, compile and run programs in either C or C++.

When you are in the Dev-C++ environment,

1. Select File | New | Source file.

[pic]

2. Type in program

3. Right BEFORE the line that says return 0;

 type this:

    system("pause");                  (pause can be lowercase or caps)

This line will keep the output window open when the program has finished executing.

 

Enter the following program into the program1.cpp file window.

Every C++ program we write will start with a comment followed by these three lines.

// hello.cpp

// A First Program in C++

#include

using namespace std;

int main()

{

cout = left to right

== != left to right

lowest precedence = += -= *= /= %= right to left

(done last)

-------------------------------------------------------------------------------------

for(num=1;num ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download