×
Create a new article
Write your page title here:
We currently have 176 articles on Open Eggbert. Type your article name above or click on one of the titles below and start writing!



Open Eggbert
176Articles

C++: Difference between revisions

No edit summary
No edit summary
Line 16: Line 16:
How to delay program and wait for the press of the key Enter: cin.get();
How to delay program and wait for the press of the key Enter: cin.get();


Printing text to console: cout << "some text"; //operator overloading : <<
Printing text to console: cout << "some text"; //operator overloading: <<
 
How to print end line: "\n" or std::endl


== Comments ==
== Comments ==

Revision as of 14:54, 13 October 2024

Author: Bjarne Stroustrup Supported programming paradigms: procedural, object-oriented, generic. Based on on the C programming language. OOP in C++ was inspired by the Simula64 programming language. All C programs are valid C++ programs. The name of the C++ programming language is related to the incremental operator "++". How to create a C++ program: compiling to object files, linking object files to an executable version of the program.

Introduction

Function main()

Function main() is the entrypoint of an C++ application.

Variants:

  • int main() {return 0;}
  • void main() {return 0;}
  • void main(void) {return 0;}
  • int main(void) {return 0;}

Console

How to delay program and wait for the press of the key Enter: cin.get();

Printing text to console: cout << "some text"; //operator overloading: <<

How to print end line: "\n" or std::endl

Comments

One line: // comment

Multi line: /* comment */

Preprocessor directives

Example: #include <iostream>

Importing namespaces

using namespace std;

using std::count;

C++ statement

Each C++ statement must be ended with the semicolon character ;