Question: my code: #include #include #include #include using namespace std; //function Prototype char *Capitalizer(char *); char again; int main() { char *newline,line[1001]; //That's A Big Buffer,

my code: #include #include #include #include using namespace std;

//function Prototype char *Capitalizer(char *); char again;

int main() { char *newline,line[1001]; //That's A Big Buffer, It Might Be TOO Big... Careful There...

cout << "This program will capitalize the first letter of each sentence. ";

cout << "Please enter a phrase of no more than 1000 characters, followed by a period. "; cin.getline(line, 1001); newline = Capitalizer(line); cout << " This is how you should have done it: ";

cout << newline; cout << endl; getch(); return 0; }

char *Capitalizer(char *sentencePrt) { int i = 0, j; do { cout << "Would you like to play again? (y/n):"; cin >> again; } while (again == 'y'); if(sentencePrt[i] > 97 && sentencePrt[i] < 112) { sentencePrt[i] -= 32; }

for(i = 0; i < strlen(sentencePrt); i++) { j = i;

if(sentencePrt[i] == '.' || sentencePrt[i] == '?' || sentencePrt[i] == '!' || sentencePrt[i] == ',') { j++;

if(sentencePrt[j] == ' ' || sentencePrt == NULL || sentencePrt == 0) { j++;

} if((sentencePrt[j] > 97 && sentencePrt[j] < 112)) { sentencePrt[j] -= 32; }

} }

//cout << sentencePrt; return sentencePrt; }

I keep getting the do while before it even show the output for the code above: I want to input the do while loop using this:

do {

cout << "Would you like to play again? (y/n):";

cin >> again;

}

while (again == 'y')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!