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
andriy [413]
3 years ago
8

6.10.1: Modify a C string parameter. Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley.

Nice to meet you." becomes: "Hello! I'm Miley! Nice to meet you!"
Computers and Technology
1 answer:
Andrej [43]3 years ago
6 0

Answer:

#include <iostream>

#include <cstring>

using namespace std;

void replacePeriod(char* phrase) {

int i = 0;

while(*(phrase + i) != '\0')

{

if(*(phrase + i) == '.')

*(phrase + i) = '!';

i++;

}

}

int main() {

const int STRING_SIZE = 50;

char sentence[STRING_SIZE];

strcpy(sentence, "Hello. I'm Miley. Nice to meet you.");

replacePeriod(sentence);

cout << "Updated sentence: " << endl;

cout << sentence << endl;

return 0;

}

Explanation:

  • Create a function called replacePeriod that takes a pointer of type char as a parameter.
  • Loop through the end of phrase, check if phrase has a period and then replace it with a sign of exclamation.
  • Inside the main function, define the sentence and pass it as an argument to the replacePeriod function.
  • Finally display the updated sentence.
You might be interested in
Throughout the lecture, the teacher speaks about the defintion of "Science"
Arlecino [84]

Answer:

I would say A. Since that is pretty much the Scientific Method.

Explanation:

Yeah

8 0
3 years ago
Read 2 more answers
What are chemical manufacturers required to provide to anyone who purchases or uses their chemicals for a work purpose? Select a
Julli [10]

Answer:

Labels and Safety Data Sheets.

Explanation:

Label is a short description of what is inside the container. And Safety Data Sheets has everything that is required. You have precautionary measures listed as well as the training details in the safety data sheets. The training PPE is hence not required definitely. However, the only other thing required is the label, as without that you will not come to know what is inside the container from outside. Hence, the above answer.

8 0
3 years ago
Read 2 more answers
(Find the number of uppercase letters in a string) Write a recursive function to return the number of uppercase letters in a str
Leokris [45]
Def countUppercase(s):
count=0
for i in s:
if i.isupper():
count+=1
s=s.replace(i, "")
else:
s=s.replace(i, "")
countUppercase(s)
return count

element=input("Enter the string: ")
string=countUppercase(element)
print("\nNumber of upper letter in the string: ",string)

3 0
3 years ago
Question is in photo
Alisiya [41]
Is this java or python pls explain or else i can’t answer
3 0
3 years ago
Describe the Pointer with example?​
kodGreya [7K]

Answer:

A pointer is a variable that stores the address of another variable. Unlike other variables that hold values of a certain type, pointer holds the address of a variable. For example, an integer variable holds (or you can say stores) an integer value, however an integer pointer holds the address of a integer variable.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Every preprocessing directive must begin with:
    11·1 answer
  • _____ is published by the U.S. Bureau of Labor Statistics. It provides up-to-date career outlook information. It is no longer av
    15·2 answers
  • What is an (CR) Optical character recognition?
    13·2 answers
  • 4. Write an appropriate comment for describ-
    11·1 answer
  • True/False/Unknown. For the interpretation of function calls, we assign the formal parametersto the valuations of the actual arg
    11·1 answer
  • Select the correct answer.
    9·2 answers
  • You are a network administrator for a company that has two buildings. You are setting up a wireless network so users can maintai
    8·1 answer
  • NEED HELP ASAP
    13·2 answers
  • I need help ASP 3rd grade math ​
    11·2 answers
  • How to mark a discussion as read on canvas dashboard.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!