COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
string_find.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include <string>
3
using namespace
std;
4
5
int
main
()
6
{
7
string
s =
"Outside it is cloudy and warm."
;
8
string
t =
"cloudy"
;
9
10
cout << s.find(
"is"
) << endl;
11
cout << s.find(
's'
) << endl;
12
cout << s.find(t) << endl;
13
cout << s.find(
'i'
, 6) << endl;
14
cout << s.find(
'o'
) << endl;
15
if
(s.find (
"the"
) == -1)
16
cout <<
"not found"
<< endl;
17
if
(s.find (
"the"
) == string::npos)
18
cout <<
"not found"
<< endl;
19
20
return
0;
21
}
main
int main()
Definition
string_find.cpp:5
Module6
Sample Code
Part III - C++ Strings
string_find.cpp
Generated on Sun Sep 29 2024 16:39:53 for COMP2113 by
1.12.0