COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string_op.cpp File Reference
#include <iostream>
#include <string>
Include dependency graph for string_op.cpp:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 5 of file string_op.cpp.

6{
7
8 string firstName = "Alan";
9 string name = firstName + " Turing";
10 string str1 = "It is sunny. ";
11 string str2 = "";
12 string str3 = "C++ programming.";
13 string str4 = firstName + " is taking " + str3;
14
15 cout << str1.empty() << endl;
16 cout << str2.empty() << endl;
17 str3.erase(11,4);
18 cout << str3 << endl;
19 cout << firstName.length() << endl;
20 cout << name.length() << endl;
21 cout << str4 << endl;
22
23 return 0;
24}