TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

C++

Basic C++ Syntax

Overview

In this tutorial, we will learn basic C++ syntax. C++ syntax is much similar to C, Java.

Statement Terminator

In C++, the semicolon is the statement terminator. Each code statement
should end with a semicolon.

Examples:

int a ;

a = 10;

We can even write two statements in a single line.

int a; a = 10;

C++ Comments

Single line comments start with a //

Multi-line comments start with /* and end with */

 

C++ Comments CodeBlocks

Code blocks

A code block is a set of logically grouped statements that are surrounded by opening and closing braces. We use curly braces to denote a code block in the C++ program.

The main function or routine block is denoted by the curly braces. The source code formatting can have different options and styles.

Allman (ANSI) Bracket style:

The curly braces are placed in the next line and the code block statements are indented to the next level.

 

int main()
{
 cout << "Hello, World!";
 return 0;
}

—

C++ Tutorials

C++ Tutorials on this website:

https://www.testingdocs.com/c-coding-tutorials/

For more information on the current ISO C++ standard

https://isocpp.org/std/the-standard

Related Posts

g not found OpenSuse

C++ /

Install GCC C++ Compiler on OpenSuse

sum of digits c program

C++ /

Sum of Digits of a Number C++ Program

C++ Hello World Program

C++ /

C++ Hello World Program

C++ /

Object-Oriented Programming Language Examples

C++ /

Object-Oriented Programming Features

‹ Compile & Execute C++ Program› C++ Identifiers

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version