So this program is supposed to take in a sentence and output it with correct spacing and capitalization.
-For example if I entered:
heY, How are You doing?
-the output should be:
Hey, how are you doing?
The program runs fine, I just cannot get it to output.
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
char * RemoveSpaces(char * source);
string makeUpper (const string& s);
string makeLower (const string& s);
int main()
{
string str;
cout << "Enter a sentence to be corrected\n"
<< "followed by pressing Enter.\n";
getline(cin, str);
return 0;
}
char * RemoveSpaces(char * source)
{
char * dest, * ret = dest = source;
while( *(isspace(*source) ? dest : dest++) = *source++ );
return ret;
}
string makeUpper(const string& s)
{
string temp(s);
char c = toupper('a');
cout << c;
for (int i = 0; i < s.length(); i++)
temp[i] = toupper(s[i]);
return temp;
}
string makeLower(const string& s)
{
string temp(s);
char c = tolower('A');
cout << c;
for (int i = 1; i < s.length(); i++)
temp[i] = tolower(s[i]);
return temp;
}