ebook img

LEARN C++ IN ONE DAY AND LEARN IT WELL: LEARN CODING FAST WITH A P RACTICAL S TEP - BY - S TEP P ROGRAMMING G UIDE PDF

79 Pages·2020·4.291 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview LEARN C++ IN ONE DAY AND LEARN IT WELL: LEARN CODING FAST WITH A P RACTICAL S TEP - BY - S TEP P ROGRAMMING G UIDE

LEARN C++ IN ONE DAY AND LEARN IT WELL: LEARN CODING FAST WITH A P S - - RACTICAL TEP BY S P G TEP ROGRAMMING UIDE DR. M M F OUBACHIR ADANI ADOUL Copyright © 2020 by Dr. Moubachir Madani Fadoul All Right Reserved No part of this publication may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, or by any information storage and retrieval system without the prior written permission of the publisher, except in the case of very brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. T C ABLE OF ONTENTS Chapter 1. C++ Introduction Chapter 2. Functions Chapter 3. Functions Chapter 4. Files Chapter 5. Conclusion About The Author Other Books By DR. MOUBACHIR MADANI FADOUL C 1. C++ I HAPTER NTRODUCTION Why Use C++ C++ is one of the widely popular programming languages used in the world. C++ is available in today's operating systems, Embedded systems and graphical User Interfaces. C++ is an object-oriented programming language which allows code to be reused, and gives a clear structure to programs and lowering development costs. C++ is portable and can be used to develop applications that can be adapted to multiple platforms. C++ is handy and easy to learn! As C++ is close to Java and C#, it is easy for programmers to switch to C++ or vice versa 1.2 C++ G S ET TARTED This step-by-step tutorial book teaches you the basics of C++. Any prior programming experience is not required. Two things are need before start using C++: Many compilers and text editors to choose from are available. In this step-by- step tutorial book, IDE will be used (see below). C++ Install IDE An “IDE (Integrated Development Environment)” is used to compile AND edit the code. Popular IDE's Code include: Eclipse, Visual Studio, and Blocks. All are free, and they can be used to both debug and edit C++ co de. Note: Web- based also can work, but with limited functionality. Code:: Blocks is used in our step-by-step tutorial book, which is the correct way to start. You can find the latest version of Codeblocks at http://www.codeblocks.org/downloads/26. Download the setup.exe of mingw file, which installs the text editor with a compiler. C++ Quickstart We create our first C++ file as follows. “Open Codeblocks and go to File > New > Empty File. Write the following C++ code and save the file as myfirstprogram.cpp (File > Save File as)”: If you don't understand the code above, don't worry – the details will be discussed in later chapters. For now, you focus should be on how to run the code. it should look like this In Codeblocks,: Then, go to “Build > Build and Run” to execute (run) the program. The below example shows the result: Congratulations! Now you have written and executed your first C++ program. 1.3 C++ S YNTAX The following code breaks up to understand it better: Example explained Omitting Namespace Some C++ programs can be executed without the need for standard namespace library. The namespace std line is omitted and changed to the std keyword, followed by the “::” operator for some objects: 1.4 C++ O (P T ) UTPUT RINT EXT Together with the << operator, the “cout object” is used to print text/output values: Many “cout objects” can be added. However, note that a new line at the end of the output cannot be inserted: 1.5 N L EW INES Inserting a new line can be done by using the \n character: Note: a blank line can be created by two \n characters after each other: A new line can also be inserted, with the “endl” manipulator:

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.