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
Which of the following should get a Page Quality (PQ) rating of Low or Lowest?
Luda [366]

Answer:

A page that gets a Didn't Load flag

Pages with an obvious problem with functionality or errors in displaying content

Explanation:

The main reason why a page gets Page Quality rating Low/Lowest is if it can't be shown for one reason or another.

A page with mismatch between the location of the page and the rating location, does have a mismatch but some form of a page is shown.

A file type other than a webpage displays that specific file type in a page framework, so page is shown

Other two do not show a page, so they will get a PQ rating Low/Lowest

7 0
3 years ago
Mr. Yang is a doctor who regards video games as an effective means of staying fit. What type of game would he recommend to his p
LUCKY_DIMON [66]

wii sports, just dance, etc.

Explanation:

3 0
2 years ago
Which type of link is normally used to interconnect two peripheral modules (pm) in the digital multiplex system (dms)?
natta225 [31]

The answer is DS-30A. The Roland DS30A is a 24-bit Digital Reference Monitor which can add pristine 24-bit/96kHz. They are small speakers.

4 0
3 years ago
Which answer choice correctly distinguishes among the three pieces of data?
wolverine [178]

Answer:

a. 1 is a packet, 2 is data, 3 is a frame.

Explanation:

And what is not  mentioned is segment which used TCP/UDP and is part of Transport layer. The packet carries the destination and sender IP address, and is part of the Network Layer. The frame has the Mac address of destination device and senders device and is part of data link layer.

Hence segment has no IP address, hence b. is not correct. Also, data cannot have the IP Address, and Frame has the MAC address, Hence, the above answer. And this arrangement is part of Data Encapsulation.

Also keep in mind data can be anything like a series of bits, or any and it can or not have a header.

7 0
2 years ago
What is printed by the following program? var isRaining = false; var isCloudy = false; var isSunny = !isRaining &amp;&amp; !isCl
hram777 [196]

Answer:

The output to this given question is "Is it warm: true".

Explanation:

In this question firstly two-variable defines that are isRaining and isCloudy. In those variables assign false value. Then we define another variable that is isSunny. In isSunny variable, we check condition that is if variable isRaining not AND (logical gate) variable isCloudy not equal to isSunny. The AND logical gate is used to check that both condition is true or not. Then we define another variable that is isWarm. In this variable, we check condition if isSunny OR (logical operator) isSummer is true. The OR operator is used to check in both value if one condition will true it will print true. At the last will print the value.

8 0
3 years ago
Other questions:
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • How does virtualization factor into a layered vs. non-layered design discussion?
    14·2 answers
  • 11.The shortcut keys used to center a paragraph are&lt;br /&gt;a. CTRL+T&lt;br /&gt;b. CTRL+M&lt;br /&gt;c. CTRL+SHIFT+T d. CTRL
    7·1 answer
  • Which code will allow Joe to print Coding is fun. on the screen? print("Coding is fun.") print(Coding is fun.) print = (Coding i
    10·2 answers
  • (9.10 Code Practice: Question 1)
    12·1 answer
  • Match the definitions of different business communication to the type of document
    7·2 answers
  • ASAP BRAINLIEST!!!!!!
    5·2 answers
  • You are trying to sell a new product to a store owner. Which method of presentation
    10·1 answer
  • Providing captions and transcripts for videos on your website is a way of ensuring what?.
    7·1 answer
  • Assume that the Vehicle class contains a virtual method named CalculateMaxSpeed(). Assume that both the MotorVehicle and Automob
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!