COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string_op.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <string>
3using namespace std;
4
5int main()
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}
int main()
Definition string_op.cpp:5