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

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 6 of file substring.cpp.

7{
8 string s;
9 string str;
10
11 s = "It is cloudy and warm.";
12
13 cout << '\"' << s.substr(0, 5) << '\"' << endl;
14 cout << '\"' << s.substr(6, 6) << '\"' << endl;
15 cout << '\"' << s.substr(6, 16) << '\"' << endl;
16 cout << '\"' << s.substr(17, 10) << '\"' << endl;
17 cout << '\"' << s.substr(3, 6) << '\"' << endl;
18 str = s.substr(0, 8);
19 cout << '\"' << str << '\"' << endl;
20 str = s.substr(2, 10);
21 cout << '\"' << str << '\"' << endl;
22
23
24 return 0;
25}