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
What does a sharp sign indicate when used in representing a pitch?
ziro4ka [17]
A sharp sign <span>(#) </span><span>indicates that a note is one half-tone or semitone step higher compared to a note without a </span>sharp<span>. </span>
5 0
3 years ago
You are purchasing a new printer. Which of the following is the most important requirement?
OlgaM077 [116]

Question↓

You are purchasing a new printer. Which of the following is the most important requirement?

Answer↓

A. Is the printer compatible with your computer's operating system?

If The Printer is Not Compatible With your Computer you will not Be able to Use Therefore, you Will have to buy a New One.

xXxAnimexXx

Hope this Helps! ^ω^

7 0
2 years ago
Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print t
geniusboy [140]

Answer:

Please find the answer below

Explanation:

// Online C compiler to run C program online

#include <stdio.h>

int main() {

   // Write C code here

   //printf("Hello world");

   int userNum;

   int i;

   int j;

   

   scanf("%d", &userNum);

   /* Your solution goes here */

   for(i = 0; i<=userNum; i++){

       for(j = 0; j <= i; j++){

           printf(" ");

       }

       printf("%d\n", i);

   }

   return 0;

}

8 0
2 years ago
Input 3 positive integers from the terminal, determine if tlrey are valid sides of a triangle. If the sides do form a valid tria
butalik [34]

Answer:

In Python:

side1 = float(input("Side 1: "))

side2 = float(input("Side 2: "))

side3 = float(input("Side 3: "))

if side1>0 and side2>0 and side3>0:

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

       if side1 == side2 == side3:

           print("Equilateral Triangle")

       elif side1 == side2 or side1 == side3 or side2 == side3:

           print("Isosceles Triangle")

       else:

           print("Scalene Triangle")

   else:

       print("Invalid Triangle")

else:

   print("Invalid Triangle")

Explanation:

The next three lines get the input of the sides of the triangle

<em>side1 = float(input("Side 1: ")) </em>

<em>side2 = float(input("Side 2: ")) </em>

<em>side3 = float(input("Side 3: ")) </em>

If all sides are positive

if side1>0 and side2>0 and side3>0:

Check if the sides are valid using the following condition

   if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:

Check if the triangle is equilateral

<em>        if side1 == side2 == side3: </em>

<em>            print("Equilateral Triangle") </em>

Check if the triangle is isosceles

<em>        elif side1 == side2 or side1 == side3 or side2 == side3: </em>

<em>            print("Isosceles Triangle") </em>

Otherwise, it is scalene

<em>        else: </em>

<em>            print("Scalene Triangle") </em>

Print invalid, if the sides do not make a valid triangle

<em>    else: </em>

<em>        print("Invalid Triangle") </em>

Print invalid, if the any of the sides are negative

<em>else: </em>

<em>    print("Invalid Triangle")</em>

4 0
3 years ago
You are going to write a program for Computer test which will read 10 multiple choice questions from a file, order them randomly
sweet-ann [11.9K]

Answer:

Code is too large , i attached a source file below and also a text file from where i get Questions

Explanation:

6 0
3 years ago
Other questions:
  • What executable programs have names that are just one character long, and what do they do??
    5·1 answer
  • What cell phone technology is the most popular in the united states?
    8·2 answers
  • Evaluating how current, credible, and unbiased a source is ensures:
    7·1 answer
  • A company gives you a document to review. This document lays out the strengths and weaknesses of a proposed business venture. It
    13·1 answer
  • Your company runs several databases on a single MySQL instance. They need to take backups of a specific database at regular inte
    12·1 answer
  • Customizing ads to people who had earlier visited the site is
    14·1 answer
  • What should be used to keep a tablet dry?
    13·1 answer
  • Hey, how is everyone????????????????????????????????
    8·2 answers
  • The table button is present in the ……… tab.​
    14·2 answers
  • Which tool can effectively increase the curl of the subject’s lips?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!