lecture1 C++.pptx
- Количество слайдов: 11
Introduction to C++ Understanding the Programming by: Bakhytzhan Myktybayev
Introduction to C++ Programming - is instructing a computer to perform a task for you with the help of a programming language. The instructing part requires a step by step solution to the task. This step by step solution is called an algorithm after the name of Al. Kharizmi. A computer program (software) contains a sequence of instructions for a computer.
Introduction to C++ Programmers - people who make computer programs. End-users - people who use the programs. A computer program (software) contains a sequence of instructions for a computer.
Introduction to C++ One program is usually composed of three parts: - Input part gets the data from an input device. Ex: from keyboard or from a text file. - Process part is the hardest working part of the program. It carries out the algorithm and finds out the desired result. - Output part gives the result of the program. Ex: on the screen or print it into a text file.
The First C++ Program #include <iostream> using namespace std; int main() { cout <<"Hello world!"; system("pause"); return 0; }
The First C++ Program A flowchart is a visual representation of the algorithms. Is is made up of a few symbols: terminal, input, process, decision, output, and connector.
Example program: #include <iostream> using namespace std; int main() { cout <<"Hello world!"; cout <<“How are you? ”; cout <<“Good Luck!!!"; system("pause"); } Try to draw flowchart for this program?
The First C++ Program Single line comments: // multiple line comments: /* */ Comments are ignored by the compiler.
Breaking a Text into Multiple Lines Use end of line "endl" or new line 'n/' characters with in a cout statement to make a new line. 'n/' characters are inherited from C programming. We prefer to use "endl” notation. Ex: Without “endl” With“endl” cout<<“hello”; cout<<“hello”<<endl; cout<<“hi”; resutl will be: hellohi result will be: hello hi
Basic Arithmetic Any statement enclosed with double quotes (" ") in a cout statement is displayed directly and any arithmetical or logical expression is evaluated and then the result is displayed #include <iostream> using namespace std; int main() { cout <<"5 + 3 =!!! "<<5+3<<endl; //calculate and print the sum system("pause"); return 0; } Result: 5 + 3 =!!! 8
Problem solution Write C++ program which result’s is shown below: Results: My name is. . I am from …. I study in …. I am … years old. My hobby is. . . ? In … place write your information’s, about your self!
lecture1 C++.pptx