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
Consider a Huffman’s Algorithm that uses a variable-length encoding scheme to compress the original text: BIRTHDAY to determine
labwork [276]

Answer:

following? 10 marks

i. Code tree

ii. Codeword

iii. Average

7 0
3 years ago
What does t'challa actions reveal about his character( black panther movie)​
Nesterboy [21]

Answer:

The answer to this question can be given as below:

Explanation:

He is the most powerful warrior, which is recognized as the Black Panther, and his kingdom hides there identity from the other kingdom people by using the technological advancement.  

  • T'Challa was the king of Wakanda, which is a part of the African nation.
  • He guards the people as just the latest in a series-long chain of Black Panther fighters as Leader of the Wakanda African Country.
6 0
3 years ago
What does the Flippy Do Pro show about representing very small numbers?
chubhunter [2.5K]

Answer:

it shows number that is near the target figure, but not the actual figure

Explanation:

What Flippy Do Pro reveal about representing a very small number is a number that is near the expected number in value. This is because Flippy Do Pro would not reveal some particular lesser numbers in their precise value.

However, this often results in roundoff blunder, which is mostly caused by the inability of bit compositions to depict the outcome of numbers as it should precisely be.

4 0
3 years ago
4-One possible performance multiplication enhancement is to do a shift and add instead of an actual multiplication. Since 9 * 6,
pychu [463]

Answer:

Check the explanation

Explanation:

The above question can be sovled in the below step by step way:

15 can be written as 16-1 = 24 -1

Therefore, 15 *13 = (24 -1)*13

= 13*24 - 13

Now, when we left shift a number we multiply it by 2k .Where k is no of times we left shifted it.

Therefore, 13*24 = shift 13 to left 4 times

15 * 13 = shift 13 to left 4 times and subtract 13 from it.

3 0
3 years ago
How will Mario know which words are misspelled in his document?
netineya [11]

Answer:

By seeing if there are any red lines under the words or go to tools.

Explanation:

Sometimes when you spell something wrong, there will be a red line under it. If not, and you're are not sure if it's correct, go to "tools" then select spelling and grammar then it'll give you corrections if they need to correct anything.

5 0
3 years ago
Read 2 more answers
Other questions:
  • You just read an msds for acetic acid. based on what you read, what type of information is included in an msds sheet? record you
    7·1 answer
  • _____________ is a service that provides access to hardware resources available over the Internet.
    11·1 answer
  • Match the items.
    15·1 answer
  • Which online resource is usually not free?
    10·2 answers
  • Optimizing a network to handle more traffic by adding new specialized software is an example of ______ scaling. Adding additiona
    9·1 answer
  • Riya wants to save her project work in an external device so that she can show it to her class teacher. Help her to choose the d
    13·2 answers
  • All computer systems have
    14·2 answers
  • The first page of a website is what?​
    5·2 answers
  • The computer scientists Richard Conway and David Gries once wrote: The absence of error messages during translation of a compute
    7·1 answer
  • How many hours do you spend on the Internet per day?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!