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
Did the first generation of computers use microprocessors.
Katena32 [7]

no they used standard 8088 Intel processors

hope this helps

8 0
2 years ago
Read 2 more answers
Where in the computer is a variable such as "X" stored?
kow [346]

Answer:

The value of "x" is stored at "main memory".

Explanation:

Simply Central processing unit, input device and output device can not store the data.

7 0
3 years ago
What did Bakers wear (1) in the Portugal does (2) when was author was young ???
konstantin123 [22]

Answer:

(i) In the Portuguese days, the bakers had a peculiar dress known as the kabai. It was a single-piece long frock reaching down to the knees.

(ii) When the author was young, he saw the bakers wearing a shirt and trousers, which were shorter than full-length and longer than half pants.

7 0
3 years ago
Write a function named ilovepython that prints out I love Python three times. Then, call that function.
Brums [2.3K]

Answer:

The program to this question can be described as follows:

Program:

def ilovepython(): #defining a method

   for i in range(3): #defining a loop that print messasge three times

       print('I love Python')#print messasge

ilovepython() #calling the method

Output:

I love Python

I love Python

I love Python

Explanation:

Description of the python program can be described as follows:

  • In the above Python program, a method "ilovepython" is defined, inside the method a for loop is used, inside the loop print method is used, that print the message "I love Python".
  • In python for loop is used to iterate over series and we can execute a set of statements with the loop, tuple, series, once for each element in the list.
8 0
3 years ago
Choose the 3 correct statements for the code below.
Nookie1986 [14]

Answer:

True

False

True

False

True

Explanation:

So I'll go through each statement and explain why or why not they're correct.

An object of the ActivationLayer class has a name attribute. So because ActivationLayer is inheriting the BaseLayer and it's calling super().__int__("Activation") it's going to call the BaseLayer.__init__ thus setting a name attribute equal to "Activation" for any ActivationLayer object that is initalized. So this is true

An object of the BaseLayer class has a size attribute. While it is true that FC layer is inheriting from BaseLayer and it has a size attribute, this does nothing to change the BaseLayer class. So any object initialized to a BaseLayer object will only have the instance attribute "self.name". So this is false

print(FCLayer(42)) prints FullyConnectedLayer. So whenever you print an object, it tries to convert the object to a string using the __str__ magic method, but if that wasn't defined it then tries the __repr__ method, which the FCLayer class technically doesn't define, but it inherits it from the BaseLayer class. And since whenever you define an FCLayer object it calls super().__init__ with "FullyConnected", which will then be assigned to the instance variable self.name,  it will print "FullyConnectedLayer". So this is true

When creating an object of the ActivationLayer class, the size argument must be given. This is true, because the size is a parameter of the __init__ method of ActivationLayer, it is not an optional parameter, and is something that must be passed otherwise an error will be raised. So this is false

When creating an object of the BaseLayer class, the name argument must be given. This is not true, because name is a default argument. This means if you do not pass an argument for name, then name will equal an empty string

4 0
2 years ago
Other questions:
  • Which of the following software is cloud-based? OpenOffice Writer Word 2013 Word Online Word Perfect\
    13·2 answers
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    7·1 answer
  • Factors of production are A. inputs into the production process. B. social and political conditions that affect production. C. t
    7·1 answer
  • Approximately what percent of desktop PCs are used for work-related purposes?
    13·2 answers
  • 3. The channel bit error rate is 0.00001, and each packet’s total length is 1024 bytes including all overheads. Assume there are
    12·2 answers
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    5·1 answer
  • XML Schemas consist of:
    15·1 answer
  • Hlo plss help.<br>.....,, ​
    7·2 answers
  • WILL GIVE BRAINLEIST PLZ HELP PLZ AND THANK YOU
    7·1 answer
  • The physical parts of a computer are called application software.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!