Substring of string find problem | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Substring of string find problem

Hey there. I have a string and want to check if a specific substring is part of that string and if so, print it or if not, say sth like not part of string. Well, I'm having some difficulties here because I'm still trying to comprehend the basics ;) See code... https://code.sololearn.com/c01NmSRjwbWJ/#cpp

25th Jun 2020, 6:16 AM
The_Fox
The_Fox - avatar
2 Respostas
+ 3
You need to add a prompt before creating the substring. If the string is not found, you canā€™t create a substring starting from npos if (found == npos) // string not found else // string found, create substring
25th Jun 2020, 7:08 AM
Bobby Fischer
Bobby Fischer - avatar
0
Thank you!
25th Jun 2020, 9:09 AM
The_Fox
The_Fox - avatar