1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex73 [517]
3 years ago
9

Create a program that includes a function called toUpperCamelCase that takes a string (consisting of lowercase words and spaces)

and returns the string with all spaces removed. Moreover, the first letter of each word is to be forced to its corresponding uppercase. For example, given "hello world" as the input, the function should return "HelloWorld". The main function should prompt the user to input a string until the user types "Q". For each string input call the function with the string and display the result. (Hint: You may need to use the toupper function defined in the header file.)
Computers and Technology
1 answer:
astraxan [27]3 years ago
8 0

Answer:

#include<iostream>

using namespace std;

//method to remove the spaces and convert the first character of each word to uppercase

string

toUpperCameICase (string str)

{

string result;

int i, j;

//loop will continue till end

for (i = 0, j = 0; str[i] != '\0'; i++)

{

 if (i == 0)       //condition to convert the first character into uppercase

  {

  if (str[i] >= 'a' && str[i] <= 'z')   //condition for lowercase

  str[i] = str[i] - 32;   //convert to uppercase

  }

if (str[i] == ' ')   //condition for space

  if (str[i + 1] >= 'a' && str[i + 1] <= 'z')   //condition to check whether the character after space is lowercase or not

  str[i + 1] = str[i + 1] - 32;   //convert into uppercase

if (str[i] != ' ')   //condition for non sppace character

  {

  result = result + str[i];   //append the non space character into string

  }

}

//return the string

return (result);

}

//driver program

int main ()

{

string str;

char ch;

//infinite loop

while (1)

{

fflush (stdin);

//cout<< endl;

getline (cin, str);   //read the string

//print the result

//cout<< endl << "Q";

// cin >> ch; //ask user to continue or not

ch = str[0];

if (ch == 'q' || ch == 'Q')   //is user will enter Q then terminatethe loop

  break;

cout << toUpperCameICase (str);

cout << endl;

}

return 0;

}

You might be interested in
Where are the results from the Advanced Find feature displayed?
Leokris [45]

Answer:

its c

Explanation:

7 0
3 years ago
________ has the ability to drag windows to the edges or corners of your screen and have them snap into place.
qaws [65]

Answer:

Snap Assist

Explanation

Snap Assist lets you snap a window to one side of your screen without having to move it around and resize it manually.

3 0
2 years ago
Define a function that will return the length of a list
Alexus [3.1K]

Answer:

len()function:

Explanation:

that's for python btw

i also know java if you want a java version

3 0
2 years ago
WILL UPVOTE &lt;3
andreev551 [17]
D. Mechanical weathering
8 0
3 years ago
Consider a file system that uses inodes to represent files. Disk blocks are 2KB in size and a pointer to a disk block requires 4
deff fn [24]

Answer:

a.  Maximum size of file = 8.003 GB

Explanation:

<u>a. Maximum size of file</u>

= (6 * 2 KB) + (2048 * 2 KB) + (2048 * 2048 * 2 KB)

= 12kb + 4096 Kb +  8388608 kb

= 8392716 kb

8392716/1024 mb = 8196.01 MB

8196.01 /1024 GB= 8.003 GB

<u>b. According to above calculation</u>

For 8 GB 6 direct, 1 single and 1 double indirect block requires

so

for 32 GB

24 direct Block

4 single and 4 double indirect block requires

7 0
4 years ago
Other questions:
  • The ____ contains methods that allow you to set physical properties such as height and width, as well as methods that allow you
    14·1 answer
  • Which statements describe the advantages of using XML?
    12·2 answers
  • Choose the correct sequence for classifier building from the following.
    7·1 answer
  • An example of an electrical insulator is _____.
    15·1 answer
  • You have been asked to create a Community leveraging Out-of-the-box login, logout, self-registration, and error pages. Would you
    5·1 answer
  • Which of the following about if statement is true? A. The condition is a Boolean expression B. A Boolean expression is something
    15·1 answer
  • Define networks, marketplaces, and platforms and discuss their differences.
    15·1 answer
  • linela Insurance needs to hire twenty accountants immediately to support its accounts receivable process. The hiring and trainin
    10·1 answer
  • Katy and her associates are approached by an aged tai chi expert to create a website for him. From her participation in an onlin
    9·1 answer
  • What best describes the ability to increase the access to server resources and provide fail-safe services by linking two or more
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!