Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2.

Similar presentations


Presentation on theme: "Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2."— Presentation transcript:

1 Computer science By/ Midhat Mohiey

2 Introduction to Programming using C ++ 2

3 3 Programming is the process of writing instructions in any computer programming language, to get the task done by a computer. C++ is a very common programming language, and a good language to start learning basic concepts with, but you need to figure out what you find most useful. To do that you will have to try different programming languages over the time see which ones fits best to you, which language structure makes sense, which one seem to be able to accomplish the goals you want etc. Writing the program is the process of breaking out your instructions step by step and instructing the compiler or interpreter to those things in the proper programming languages.  Your first step is to figure out exactly what you want your program to do, step by step. It is helpful to write this out on paper(Algorithm). Once you gain more experience you will start to see the value in doing this.  Once you have your steps figured out,you will want to write a program in the language you have choosen. Whatever [programming language you choose, it will have specific word and styles to do different things. Much like we use words and punctuation every day, so do programs.

4 4 The origin of C++ C++ is an object oriented language and was developed by Bjarne Stroustrup starting in 1979 at AT and T Bell laboratories as an enhancement to the C programming languages and originally named C with classes. It was renamed C++ in 1983 where ++ is an incrementer operator in C and C++.The Programming language was developed at AT and T for the purpose of writing the UNIX operating system. C was developed with the primary goal of Operating efficiency. Bjarne Stroustrup developed C++ in order to add objects oriented constructs to the C language. C++ is also considered t\as the combination of C along with Object Oriented features of Simula7. C++ is also a traditional procedural language with some additional constructs. A well written C++ program with some additional constructs. A well written C++ program will reflect elements of both object oriented programming style and classic procedural programming. C++ is actually an extensible language since we can define new styles in such a way that they act just like the predefined types which are the part of standard language C++ is designed for large scale software development. C++ is regarded as a “ Middle-level” language, as it comprises combination of both high-level and low-level language features.

5 5 Programming language can be classified into following types: –Machine Language Machine language are the only language understood by computers. While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers..

6 Assembly language Assembly languages have the same structures and set of commands as machine languages but they enable a programmer to use names instead of numbers.

7 High Level languages A programming languages such as C, FORTRAN or PASCAL that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages. Machine languages and Assembly languages both are low-level languages since they are closer to the hardware

8 Some Well-Known Programming Languages BASIC FORTRAN COBOL C C++ C# Java JavaScript Python Ruby Visual Basic

9 Integrated Development Environments (IDEs)

10 What is a Program Made of? Common elements in programming languages: 1)Key Words 2)Programmer-Defined Identifiers 3)Operators 4)Punctuation 5)Syntax

11 Program 1-1

12 1.Key Words Also known as reserved words Have a special meaning in C++ Can not be used for any other purpose Key words in the Program 1-1: using, namespace, int, double, and return

13 Key Words

14 2)Programmer-Defined Identifiers Names made up by the programmer Not part of the C++ language Used to represent various things: variables (memory locations), functions, etc. In Program 1-1: hours, rate, and pay.

15 3)Operators Used to perform operations on data Many types of operators: –Arithmetic - ex: +,-,*,/ –Assignment – ex: = Some operators in Program1-1: > = *

16 Operators

17 4)Punctuation Characters that mark the end of a statement, or that separate items in a list In Program 1-1:, and ;

18 Punctuation

19 5)Syntax The rules of grammar that must be followed when writing a program Controls the use of key words, operators, programmer-defined symbols, and punctuation

20 20 Structure of simple c++ programs #include using namespace std; int main() { cout << "welcome ITC students in c++ world " << endl; return 0; }

21

22

23 23 #include Lines beginning with a hash sign (#) are directives for the prepocessor. In this case the directives #include tells the processor to include the header file iostream which is a standard file. This specificfile (iostream) includes the declarations of the basic standard input-output library in C++, and is included because functions (cout) from this file is used in the program

24 A BEGINNER’S C++ PROGRAM Screen output Enjoy yourself with C++!

25


Download ppt "Computer science By/ Midhat Mohiey. Introduction to Programming using C ++ 2."

Similar presentations


Ads by Google