Write two alternate functions specified below, each of which simply triples the variable count defined in main. These two functions are: a. Function tripleByValue that passes a copy of count by value, triples the copy and returns the new value.b. Function tripleByReference that passes count by reference via a reference parameter and triples the original value of count through its alias(i.e. the reference parameter)For example, if count

Answers

Answer 1

Answer:

Following are the code to this question:

#include <iostream>//header file

using namespace std;

int triplebyValue(int count)//defining a method triplebyValue

{

int x=count*3;//defining a variable x that multiply by 3 in the count  

return x;//return value of x

}

void triplebyReference(int& count)//defining a method triplebyReference that hold count variable as a reference in parameter

{

count*=3;//multipling a value 3 in the count variable

}

int main()//main method

{

int count;//defining integer variable

count=triplebyValue(3);//use count to call triplebyValue method

cout<<"After call by value, count= "<<count<<endl;//print count value with message

triplebyReference(count);//calling a method triplebyReference

cout<<"After call by reference, count= "<<count<<endl;//print count value with message

return 0;

}

Output:

After call by value, count= 9

After call by reference, count= 27

Explanation:

In this code two methods "triplebyValue and triplebyReference" are declared, which accepts a count variable as a parameter, and in both multiply the count value by 3 and return its value.

Inside the main method, an integer variable "count" is declared that first calls the "triplebyValue" method and holds its value into count variable and in the next, the method value is a pass in another method that is "triplebyReference", and use print method to print both methods value with a message.


Related Questions

ERIC'S Company sells cement at 30.0 Ghana Cedis per bag. The company

however gives discount of 15% for customers that buy 100 or more bags, and 0% for

customers that buy less than 100 bags.
Write a pseudo code and present a flowchart that

will display the discount percentage when the quantity of bags purchased is entered.​

Answers

Answer:

The pseudocode is as follows:

Input Quantity

Discount = 0%

If Quantity >= 100:

    Discount = 15%

Print Discount

See attachment for flowchart

Explanation:

This line gets the quantity from the user

Input Quantity

This line initializes the discount to 0%

Discount = 0%

This checks if quantity is more than or equal to 100

If Quantity >= 100:

If yes, discount is set to 15%

    Discount = 15%

This prints the discount percentage

Print Discount

See attachment for flowchart

System software includes all of the following except

Answers

Answer:

System software includes all of the following except Browsers.

Explanation:

I just know

System software includes all the following except Browsers. There are the based on the system software are the important parts.

What is software?

Software is the term for the intangible. The software is the most significant aspect. Software is a collection of rules, data, or algorithms used to run machines and perform certain tasks. Apps, scripts, and programs that run on a mobile device are referred to as software.

According to the system software, are the based on the operating system, management system, are the networking, translators, software utilities, are the networking. They are the browsers are not the used of the software, the significant components are the configuration.

As a result, the system software includes all the following except Browsers.

Learn more about on software, here:

https://brainly.com/question/985406

#SPJ2

BitTorrent, a P2P protocol for file distribution, depends on a centralized resource allocation mechanism through which peers are able to maximize their download rates.
True or False?

Answers

Answer:

yes. it is true. mark as brainlest

Other Questions
500g to 0.4kg as a ratio Why does stock have more potential for higher returns than bonds? earth is one of the planets in the uhm please help me :)..........,. You've decided to give your best friend abag of marbles for his birthday.Since you know that your friend likesgreen marbles better than red ones, thebag has twice as many green marbles asred.The label on the bag says it contains atotal of 84 marbles.How many green marbles are in the bag? In triangle ABC, A is a right angle and M B=45. Find BC. If you answer is not an integer, leave it in simplest radical form. 3/4(1/6x+16)=3/7(4 3/8x-21) I WILL AWORD BRILLENEST :> A essay baced on lets porrtect the environment (about 1000words) Directions: Answer the following questions, showing all pertinent work. Paul has a 40 ft. by 30 ft. pole barn on his farm that he wants to move. The southeast corner of the pole barn is currently located 50 ft. west and 25 ft. north of the stock tank where the cows get their water. Paul wants to move the pole barn so the southeast corner of the barn is located 80 feet east and 80 feet south of the stock tank. 1. Complete the transformation statement for moving Pauls pole barn. (x, y)(x + _______ , y + _______ ) continue to the next page Which of the following is an example of an anagram?baseball = sportslisten = silentbanana = fruitcat = hat HOW DO YOU FIND PERCENT INCREASE 9(2x + 15) = 45Can you help me? 3. A company makes a profit of $15 per software program and $10 per video game. The company can produceat most 70 software programs and at most 80 video games per week. Total production cannot exceed 100items per week. How many items of each kind should be produced per week in order to maximize the profit?Use linear programming to solve. Show all your work. AYUDA PORFAVOR!!!Contesta la siguiente pregunta basada en la Autobiografa de Rubn Daro. A los 26 aos de edad, Daro cumpli su sueo de (3 points) A. trabajar en una oficina de correos y telgrafos.B. conocer al presidente de la Repblica de Argentina. C. conocer Buenos Aires, Argentina. D. ser periodista. What is the relationship between someone please help me A 60 kg student weighs 600 N. He does a bungee jump. Calculate the change in gravitational potential energy as the student falls 50 m. Give the unit. Will give brainliest! Find the range of the data in the box plot below.cokiesNumber of cookies eatenby each contestant What actions did Wu-Ti take to improve Chinas economy? please help if you are good at math :( thank you