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
s2008m [1.1K]
3 years ago
7

IN C++ PLEASE!!!! Define a function FilterStr() that takes a string parameter and returns "Good" if the character at index 4 in

the string parameter is uppercase. Otherwise, the function returns "Bad".
Ex: FilterStr("sandwich") returns

Bad

Recall isupper() checks if the character passed is uppercase. Ex: isupper('A') returns a non-zero value. isupper('a') returns 0.

string's at() returns a character at the specified position in the string. Ex: myString.at(3)
)
#include
#include
#include
using namespace std;

/* Your code goes here */

int main() {
string input;
string output;

getline(cin, input);
output = FilterStr(input);
cout << output << endl;

return 0;
}
Computers and Technology
1 answer:
Ilia_Sergeevich [38]3 years ago
8 0

Answer:

Replace /*Your code goes here */ with

string FilterStr(string str){

   string retStr= "BAD";

   if(isupper(str.at(4)) != 0){

     retStr = "GOOD";

   }

   return retStr;

}

Explanation:

This defines the function

string FilterStr(string str){

This initializes the return string to BAD

   string retStr= "BAD";

This checks if the string at index 4 is uppercase;

   if(isupper(str.at(4)) != 0){

If yes the return string is updated to GOOD

     retStr = "GOOD";

   }

This returns the return string

   return retStr;

}

<em>See attachment for complete program</em>

Download cpp
You might be interested in
1.<br> The correct way to use a seat belt is
Nesterboy [21]

Answer:

4 steps

Explanation:

Step 1: Pull belt across body

Sit in any of your vehicle's seats and secure the three-point harness in its buckle by pulling it across your body.

If the seatbelt is too short, consider an aftermarket restraint and extender. Make sure they meet federal safety standards and are installed professionally.

Step 2: Adjust lower belt

Adjust the lower belt snuggly across your lap and pelvis area – never your stomach.

Pregnant women should wear the lap belt below their belly, not on or above it.

Step 3: Adjust shoulder belt

Adjust the shoulder belt to fit comfortably across the collarbone and chest. It should never rub on your neck or face. Never put the shoulder belt behind your back or under your arm.

Step 4: Check before driving

Check that the belt is secure before driving.

4 0
2 years ago
If you define a function name, and it turns purple instead of blue, what should you do?
xenn [34]
You should change the name of the function
3 0
3 years ago
Write switch-case statement that displays the following information if the temperature is the input Activities at Lake LazyDays
Marta_Voda [28]

Answer:

//here is code in c++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// variable

int temp;

cout<<"Please enter the temperature:";

//read temperature from user

cin>>temp;

int n;

// reduce the case for switch

n=temp/10;

// print output according to the switch case

switch (n) {

case 7:

case 6:

cout<<"tennis"<<endl;

break;

case 5:

case 4:

cout<<"golf"<<endl;

break;

default:

if(temp>=80)

cout<<"swimming"<<endl;

else

cout<<"skiing"<<endl;

break;

}

return 0;

}

Explanation:

Read the value of temperature from user and assign it to variable "temp".

Calculate n=temp/10, to limit the number of cases in the switch statement.

if temperature is greater or equal 60 & less than 80, it will print "tennis".

If temperature is greater or equal 40 & less than 60, it will print "golf".

in default case, if temperature is greater than 80, it will print "swimming".

if less than 40, print "skiing".  

Output:

Please enter  the temperature::67                                                                                        

tennis

3 0
3 years ago
If a user copies the formula D15 into D16, what would the formula read in D16?
ella [17]
=B16*C16 hope that helped
4 0
3 years ago
Read 2 more answers
When a router connects to and communicates over the internet, it has a ________ ip address that is routable over the internet.?
Bond [772]
It is a shared ip address
7 0
3 years ago
Other questions:
  • What is the synonym for term port?
    9·1 answer
  • the piece of hardware that contains the circuitry that processes the information coming in to the computer
    13·1 answer
  • The four key stages with regards to data visualization workflow. Select one key stage and explain it briefly about that stage.St
    10·1 answer
  • Explain what middleware is. Name a common middleware in two-tier client/server architecture for database applications.
    10·1 answer
  • What tool should you use to look for information on a network?
    14·2 answers
  • Who is the first British in Europe ​
    10·1 answer
  • 1a. Ust Seven (7) Components of a Computer?
    13·1 answer
  • Use the drop-down menus to explain what happens when a manager assigns a task in Outlook.
    6·2 answers
  • What are the top 10 most dangerous computer viruses ?
    13·1 answer
  • Criminal investigations are limited to finding data defined in the search ____.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!