I had to create a program which seprates a word if there is an upper key
ex
kyaBeChutiye
should become kya be chutiye
or
FuckYouDickhead
should become Fuck you dickhead
I created this code, it does work... Anyone who wants to use it, add to it or give me suggestions to improve it please do freely, Cheerz. Happy coding!
#include< iostream >
#include< string >
using namespace std;
int main()
{
string sentence;
int i;//Loop variable
//Inputting string
cout<<"Enter sentence:";
cin>>sentence;
i=1;
while(i<sentence.length())//While loop repeats untill end of sentence
{
if(isupper(sentence.at(i)))//Checks for upper case character
{
sentence.insert(i," "); //Inserting space
sentence.at(i+1)=tolower(sentence.at(i+1)); //Converting to lower case
}
i++;
}
cout<<sentence<<endl;
//Pause system for a while
system("pause");
}
/* Output
Enter sentence:StopAndSmellTheRoses
Stop and smell the roses
Press any key to continue . . .