DEV Community

tcharles23
tcharles23

Posted on

Statements in C++

Alt Text

What is C++? C++ is an object-oriented programming language. It is an extension of the C programming language. The C programming language was built primarily as a system programming language. Over time people build an extension to the C programming language like C++. C++ is a great programming language for situations in high performance and precise control over memory. You can build different types of applications in C++. The different types of applications are video games, real-time systems such as manufacturing or transportation, high-performance trading application, and productively/office applications. Next step in the article, I would talk about some of the basics of C++ such as making statements.

In C++, they have different types of statements. C++ have Declaration statements, jump statement, expression statement, component statements, selectional statements, iterations statements, and Try blocks. I know that's a lot of different statements. I'm only going to go over expression statements, selection statements, and Iteration statements.

What are expression statements in C++? Before I answer that, let's review statements in C++. A statement is a block of code that does something. Most statements in C++ are mostly assignments or functional calls.

Alt Text

When this code runs in the console, it prints 'I like to code'. The previous code snippet is a function call which means its an expression.
Next, I will talk about compound statements.
Compound statements or blocks are sequences of statements enclosed by curly braces.

Alt Text

Iteration statements are repeated statements that execute so code. Some iterations statements are for loops, do-while loops, and while loops.
While loops:
Alt Text

for loop:

Alt Text

do-while loop:
Alt Text

C++ is an object-oriented programming language that is a populator. I'm still learning more about C++. I just briefly went over the statements in C++. It's a lot of documentation on C++ so I encourage you to learn more about it. If you want to build video games or real-time fast applications, C++ is a great programming language to use to build out those applications.

Top comments (0)