16 lines
333 B
C++
16 lines
333 B
C++
#include <iostream>
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
int main(){
|
|
string str1 = "My head is full of rocks, rocks I say!";
|
|
string str2 = "paper";
|
|
|
|
cout << int(str1.find(str2)) << endl;
|
|
|
|
// let's check what happens at runtime if I access
|
|
// outside the length of a string
|
|
|
|
cout << str2.length() << endl;
|
|
return 0;
|
|
} |