Created
August 20, 2017 21:57
-
-
Save anonymous/ec69054404e0aa8df95531c9d97a24ec to your computer and use it in GitHub Desktop.
Supposed to cut up sentences.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "D:\Users\Tijn\MyStuff\MyDocs\Visual Studio 2015\Projects\std_lib_facilities.h" | |
string Longestword(string sen) | |
{ | |
string word; | |
int b = 0; | |
vector <string> v; | |
for (int a = sen.length(); a > 0; a--) | |
{ | |
if (sen[b] == ' ') | |
{ | |
v.push_back(word); | |
} | |
else | |
{ | |
word = word + sen[b]; | |
} | |
} | |
b++; | |
cout << v[1]; | |
return 0; | |
} | |
int main() | |
{ | |
string practice = "I am going to test this!"; | |
Longestword(practice); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment