Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago