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
It takes you 0.8 of a minute to read each page of your health book. It takes you 5.5 minutes to take the test at the end. How lo
NeTakaya
The answer would be 13.3125 because 6.25 / 0.8 is 7.8125 than add 5.5 which will equal 13.3125. I'm sure about this.
7 0
3 years ago
Read 2 more answers
300134223+304532264440=
sweet [91]

Answer:

304,832,398,663

hope it helps

3 0
3 years ago
Read 2 more answers
What type of network is the internet
shtirl [24]

Answer:

The internet is considered as Wide Area Network (WAN).

5 0
3 years ago
Linda is searching for a new job. Which information would her potential employers likely review in her social profile?
nasty-shy [4]
The answer will be A they would wanna know about her work history
3 0
3 years ago
Read 2 more answers
Multimedia computer system required the following hardware component they are what​
Lady bird [3.3K]
To develop the system of multimedia we use the various hardware/softwarecomponents are:

The CPU: The CPU, which

is recommended for a multimedia computer should be Pentium IV or other advanced chips. The Monitor: The multimedia PC should be equipped with a monitorhaving Super

Video Graphics Arrays (SVGA) card.

Mark me as brainliest please
3 0
3 years ago
Other questions:
  • If you don't know whether to write too, two, or to, you should use the spell-checker to help you decide. true or false?
    7·1 answer
  • A relative path name defines a path from_________________________ Select one: a. from the UFD (user file directory) b. the curre
    6·1 answer
  • An organization is concerned with the amount of sensor data that is being generated locally, analyzed in the cloud, and returned
    6·1 answer
  • Which one of these is correct PI of a XML document?
    13·1 answer
  • Consider a swapping system in which memory consists of the following hole sizes in memory order: 10 MB, 4 MB, 20 MB, 18 MB, 7 MB
    9·1 answer
  • BRAINLEST AND 20 POINTS! Most GUls provide all of the following except
    6·2 answers
  • If you delete a shortcut from your desktop, have you also deleted the original file?
    11·2 answers
  • Choose the tag required for each stated goal.
    12·1 answer
  • Question 2/21
    11·1 answer
  • Can you exclude header rows from sort in excel?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!