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
DedPeter [7]
3 years ago
7

The intention of this problem is to analyze a user input word, and display the letter that it starts with (book → B).

Computers and Technology
1 answer:
yulyashka [42]3 years ago
3 0

Answer:

Here is the C++ program:

#include<iostream>  // to use input output functions

using namespace std;     //to identify objects like cin cout

void StartChar(string str)  {  // function that takes a word string as parameter and returns the first letter of that word in capital

   int i;  

   char c;

   do  //start of do while loop

   {

   for (int i = 0; i < str.length(); i++) {  //iterates through each character of the word str

       if(str.length()>25){  //checks if the length of input word is greater than 25

           cout<<"limit exceeded"; }  //displays this message if a word is more than 25 characters long

      c = str.at(i);   // returns the character at position i

       if (! ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) ) ) {  //checks if the input word is contains characters other than the alphabet

            cout<<str<<" is not a word!"<<endl; break;}  //displays this message if user enters characters other than the alphabet

        if (i == 0) {  //check the first character of the input word

           str[i]=toupper(str[i]);  //converts the first character of the input word to uppercase

           cout<<str<<" starts with letter "<<str[i]<<endl;  }  // prints the letter that the word starts with in capital letter

   }   cout<<"Enter a word: ";  //prompts user to enter a word

      cin>>str;   //reads input word from user

}while(str!="#");   }    //keeps prompting user to enter a word until the user enters #

int main()   //start of the main() function body

{ string str;  //declares a variable to hold a word

cout<<"Enter a word: "; //prompts user to enter a word

cin>>str; //reads input word from user

   StartChar(str); }  //calls function passing the word to it

     

Explanation:

The program prompts the user to enter a word and then calls StartChar(str) method by passing the word to the function.

The function StartChar() takes that word string as argument.

do while loop starts. The for loop inside do while loop iterates through each character of the word string.

First if condition checks if the length of the input word is greater than 25 using length() method which returns the length of the str. For example user inputs "aaaaaaaaaaaaaaaaaaaaaaaaaaa". Then the message limit exceeded is printed on the screen if this if condition evaluates to true.

second if condition checks if the user enters anything except the alphabet character to form a  word. For example user $500. If this condition evaluates to true then the message $500 is not a word! is printed on the screen.

Third if condition checks if the first character of input word, convert that character to capital using toupper() method and prints the first letter of the str word in capital. For example if input word is "Computer" then this prints the message: Computer starts with the letter C in the output screen.

The program keeps prompting the user to enter the word until the user enters a hash # to end the program.

The output of the program is attached.

You might be interested in
Terminal emulation, especially the unprotected ____________________ protocol, should be blocked from any access to all internal
Ivahew [28]

Answer:

telnet

Explanation:

<h2><u>Fill in the blanks </u></h2>

Terminal emulation, especially the unprotected <u>telnet </u>protocol, should be blocked from any access to all internal servers from the public network.

4 0
3 years ago
Operands may be any of the following: (select all that apply) Group of answer choices constant or constant expression register n
attashe74 [19]

Answer:

constant or constant expression

register name

variable name (memory)

Explanation:

Literally, operand means data which an operation can be performed on. The operation could be an arithmetic or logical operation.

From the list of options, several operations can be performed on:

  • constants e.g. \pi = 3.14
  • registers and
  • variables e.g. (a + b)

<em>However, no operation can be performed on keywords and/or reserved words.</em>

3 0
3 years ago
Janice, who is 15, posts post a picture of herself drinking alcohol and making an obscene gesture on her social network page. wh
mars1129 [50]

answer

A and B

Explanation.

A and B are the answers because this a real life scenario.

it's also can ruin her dreams on going to college to get a degree on what she want's to be and job application on her degree or any kind of job.

8 0
3 years ago
Read 2 more answers
. Which of the following is NOT a
joja [24]

Answer:

solution

Explanation:

The correct option is - solution

Reason -

To solve a problem,

Firstly we give input , then system will process that input which then gives output.

Solution is not a part of the process.

So, Solution is not a significant part of a simple problem.

7 0
2 years ago
What is metrical task system algorithm?? and can we use that in online shopping project??
jeyben [28]

Answer:

Metrical task system algorithm is the online algorithm that is used for organizing the online problems like k-server issues, paging issues etc.This task system works in the form of metrics to decrease the complete cost  experienced due to processing of the operation and analyzing the competition.

It can be used for the online shopping project for the analyzing the comparison between the performance on basis of online and offline trends and then optimization can take place according to the the results.

7 0
3 years ago
Other questions:
  • SOMONE TELL ME THERE ROBLOX USER NAME AND DO U PLAY IT!!!!! MINE IS Borutouzimaki2133
    9·2 answers
  • What is the last step in conducting url search
    11·1 answer
  • Which statement is true about parity in RAM?
    11·1 answer
  • What is one problem you should keep in mind when researching information on the Internet?
    6·2 answers
  • All queries have an explicit location. true of false
    13·2 answers
  • How can you achieve an effect like that shown in the image?
    7·2 answers
  • What is an operating system?<br>​
    11·2 answers
  • hey guys just dropped some hot beats so go and follow me my user is the beats and comment if you would do that that would be gra
    11·1 answer
  • Who addicted to fnaf
    5·2 answers
  • Which option should Gina click to edit the text contained in a text box on a slide in her presentation?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!