Apuntes
Sin título
Contenido del apunte (1)
Página 1
c ++
1) boolean name bool isittrue=true;
2) concatenate concatenate add two strings (+)
3) use the correct function to print the length of the txt string.se the correct function to print the length of the txt string
( string text ="Hello"
cout << txt.length(); )
4) Access the first character (H) in myString and print the result:Access the first character (H) in myString and print the result:
string myString = "Hello";
cout<<myString[0];
5) in string use single qutoes
6)Use the correct function to read a line of text which is put in by the user.Use the correct function to read a line of text which is put in by the user.
string fullName;
cout << "Type your full name: ";
getline (cin, fullName);
cout << "Your name is: " << fullName;
7)Use the correct function to print the highest value of x and y.Use the correct function to print the highest value of x and y
int x = 5; int y = 10;
cout<<max(x,y) // like m you can use round also
7) header file in c++ s ( cmath )
8)Fill in the missing parts to print the value true (for true):Fill in the missing parts to print the value true (for true):\
int x = 10; int y = 9;
cout <<(x>y);
9) (ternary operator):(ternary operator):if else
int time = 20;
string result =(time < 18) ? "good day" : "Good evening.";
cout << result;
Información
- Descripción
- Apunte sobre Sin título, creado por nethmi shehara el 27/09/2023.
- Creado por
- nethmi shehara · sep 2023
- Actualizado
- 27 sep 2023
- Visitas
- 1
- Valoración