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
what is the system that connects application repositories, systems, and it environments in a way that allows access and exchange
geniusboy [140]

The system that connects application repositories, systems, and it environments in a way that allows access and exchange of data over a network by multiple devices and locations is called Cloud integration.

<h3>What is the role of a cloud integrator?</h3>

Cloud-based integration is a type of systems integration business that focuses on data, process, service-oriented architecture, and application integration. It is offered as a cloud computing service.

Therefore, An integrator of the cloud offers services to help organizations integrate their software programs. Data conversion, process design, architecture, and application setup fall under this category.

Learn more about Cloud from

brainly.com/question/9759640
#SPJ1

5 0
1 year ago
Evan is borrowing a friend's laptop to check out some groovy music files. What can Evan look for to quickly identify
Yuki888 [10]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct option for this question is the file extension. Because, by knowing the file extension, you can easily understand and know what the file is. If Evan checking out some groovy music files then he will definitely look at the file format to know that is it the music file or not.

Other options are not correct because:

messaging app function is to send the message, receive and store the message while hardware does not have any relation to identifying the music file and system software is an example of an operating system that also does not help the Evan for looking at music file on the laptop.

7 0
3 years ago
write a recursive bool valued function containsvowel that accepts a string and returns true if the string contains a vowel
zhannawk [14.2K]

Answer:

Write a recursive, bool-valued function, containsVowel, that accepts a string and returns true if the string contains a vowel. A string contains a vowel if: The first character of the string is a v…

Explanation:

A:

bool containsVowel (string s) { bool hasVowel=false; if (s.length()==0) return false; else if (s[0]=='a'|| s[0]=='e'|| s[0]=='u'|| s[0]=='o'|| s[0]=='i'|| s[0]=='A'|| s[0]=='E'|| s[0]=='U'|| s[0]=='O'|| s[0]=='

7 0
3 years ago
If you wouldn't want someone to photograph you doing something, don't photograph someone else in that situation either. True Fal
Sunny_sXe [5.5K]

In the United States, it's illegal for a photographer to use someone's likeness ... Model release forms contain conditions on working with people, and in some ... You'll need this release form if you want to publish photos of another person's ... If you don't want to take any legal risks, then use a photo release form to be safe.

4 0
3 years ago
What could prevent ping or traceroute responses from reaching the originating device beside network connectivity issues?
zysi [14]
Many admins set their firewalls to drop echo-request packets to prevent their networks from being mapped via "Ping Sweeps".

A remote possibility is that there's too many hops between the source and target and the packet's TTL expires.
3 0
4 years ago
Other questions:
  • Answer the following questions which are based on the study "Patients' Engagement with Sweet Talk." Submit your answers to the e
    9·1 answer
  • What are the tasks of a doc file
    15·1 answer
  • Horizontal lines should be avoided in photographs because they make the photograph appear small.
    8·1 answer
  • Which piston stroke of the four-stroke cycle prepares the fuel mixture for combustion??
    8·1 answer
  • If you're looking to install Gigabit Ethernet, what cabling system would you use?
    9·1 answer
  • Assume you are a security professional. You are determining which of the following backup strategies will provide the best prote
    10·1 answer
  • 9. Differentiate between bolding and highlighting<br>text.<br>(2 marks)​
    15·2 answers
  • What If smart phones / computers didn't exist? <br>​
    5·1 answer
  • Significant design efforts, during deliberate planning at combatant commands, produce results as those commands _____. (Select a
    5·1 answer
  • if a manager identifies numerous data integrity issues, she/he should consider the reports generated from that data as invalid a
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!