Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Introduction to String | Variables and Data Types
C++ Introduction

Introduction to StringIntroduction to String

You can also store text in variables, in addition to symbols using char. For this, you need to:

  • Connect the string file;
  • Use std scope resolution;
  • Declare a variable of type string.
cpp

main.cpp

Strings variables can also contain numbers (as text):

cpp

main.cpp

If you try to add two string variables, you get a concatenation (it works without spaces):

cpp

main.cpp

The same thing will happen with numbers – they will not be added algebraically.

What will the console display?

Selecciona la respuesta correcta

¿Todo estuvo claro?

Sección 2. Capítulo 4
course content

Contenido del Curso

C++ Introduction

Introduction to StringIntroduction to String

You can also store text in variables, in addition to symbols using char. For this, you need to:

  • Connect the string file;
  • Use std scope resolution;
  • Declare a variable of type string.
cpp

main.cpp

Strings variables can also contain numbers (as text):

cpp

main.cpp

If you try to add two string variables, you get a concatenation (it works without spaces):

cpp

main.cpp

The same thing will happen with numbers – they will not be added algebraically.

What will the console display?

Selecciona la respuesta correcta

¿Todo estuvo claro?

Sección 2. Capítulo 4
some-alt