Variables Recap
In this lesson we learned the basic concepts of working with variables in C++:
- Variables are used to store data in a program and we can change them at any time.
- Every variable must have a declared data type that determines what values it can contain.
- Basic data types are:
intfor whole numbersdoubleandfloatfor decimal numberscharfor individual charactersboolfor boolean valuesstringfor text
- We can declare and initialize a variable separately or at once.
- For printing variables we use
std::coutand the<<operator. - Variable names must start with a letter or underscore and cannot contain spaces.
How to write:
"
Shift + ů
{
Alt Gr + b
}
Alt Gr + n
#
Alt Gr + š
Instructions
Look at the sample code that demonstrates all the concepts we learned in this lesson. When you're ready, you can continue to the next lesson!
Start programming for free
6/6