Strings
As we mentioned before strings are used for storing text. Let’s explore some useful functions using this type of variables.
To concatenate 2 (or more) lines to store the result in the new variable, use the operator +:
1234string a = "Hello "; string b = "World"; string c = a + b; cout << c;
String variables contain functions that help perform certain operations on them.
For example, you can find the length of the string variable using the built-in function .length():
12string a = "Hello user!"; cout << a.length();
You can also concatenate strings using the built-in function .append():
12string a = "Hello "; cout << a.append("everyone!");
¡Gracias por tus comentarios!
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Pregunte me preguntas sobre este tema
Resumir este capítulo
Mostrar ejemplos del mundo real
Genial!
Completion tasa mejorada a 3.7
Strings
Desliza para mostrar el menú
As we mentioned before strings are used for storing text. Let’s explore some useful functions using this type of variables.
To concatenate 2 (or more) lines to store the result in the new variable, use the operator +:
1234string a = "Hello "; string b = "World"; string c = a + b; cout << c;
String variables contain functions that help perform certain operations on them.
For example, you can find the length of the string variable using the built-in function .length():
12string a = "Hello user!"; cout << a.length();
You can also concatenate strings using the built-in function .append():
12string a = "Hello "; cout << a.append("everyone!");
¡Gracias por tus comentarios!