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
Airida [17]
3 years ago
14

Write two alternate functions specified below, each of which simply triples the variable count defined in main. These two functi

ons 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
Computers and Technology
1 answer:
Vedmedyk [2.9K]3 years ago
7 0

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.

You might be interested in
QUESTION 1 _____ is a type of data encryption that enables users of the Internet to securely and privately exchange data through
valkas [14]

Answer:

The correct answer to the following question will be Option B (Public key infrastructure).

Explanation:

This seems to be a program that allows an individual to deliver an encrypted message or file through some kind of public key that can be unlocked by the intended receiver using another key or code, almost always a private or personal key.

  • This is a collection of functions, rules, equipment, applications, and methods required to develop, maintain, deliver, utilize, save, and withdraw digital credentials, and handle encryption with the public key.
  • This safeguards against hacking or interference with customer information or data.

6 0
3 years ago
Which of the following statements is true?
nexus9112 [7]
Gray hat hacker work at a more advanced level then white and black hat hackers
3 0
3 years ago
Read 2 more answers
Smart art is considered a​
mina [271]

Explanation:

visual representation of information and ideas, and a chart is a visual illustration of numeric values or data. Basically, SmartArt graphics are designed for text and charts are designed for numbers. Use the information below to decide when to use a SmartArt graphic and when to use a chart.

4 0
3 years ago
Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
miskamm [114]

Personally I just leave them in my inbox because who cares, Alison should; however, move them to the trash I guess

7 0
3 years ago
When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
Brilliant_brown [7]

Answer:

In order to observe best practices, and to meet with technical and other requirements, organizations often use frameworks for cybersecurity compliance and regulatory compliance. These frameworks provide best practices and guidelines to assist in improving security, optimizing business processes, meeting regulatory requirements, and performing other tasks necessary to achieve specific business objectives such as breaking into a particular market niche or selling to government agencies.

Many such frameworks exist, and the recommendations set out in them can impose difficult and often expensive demands on enterprise resources – especially in situations where an organization is subject to a number of regulatory compliance regimes, whose requirements it has to meet while maintaining its own strong cybersecurity status.

Explanation:

4 0
3 years ago
Other questions:
  • Which mode can students use to ensure that their information is not saved in their Chrome browser
    15·1 answer
  • What device consisting of a screen and keyboard was used to connect to a mainframe computer?
    6·1 answer
  • Is cloud computing a hardware service used to keep computers working? True or False
    11·1 answer
  • Modify the program so that it can do any prescribed number of multiplication operations (at least up to 25 pairs). The program s
    9·1 answer
  • Which of the following terms describes a type of useful and legitimate software that is distributed by a developer where they do
    10·1 answer
  • if an open cut or wound is exposed to contamination washing it in hot water and hand soap is not sufficient to keep safe
    14·2 answers
  • What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user prog
    11·1 answer
  • Assume the existence of a BankAccount class with a constructor that accepts two parameters: a string for the account holder's na
    14·1 answer
  • HELP! WILL GIVE BRAINLYEST!
    13·1 answer
  • Writea SELECT statement that uses the ranking functions to rank products by the total quantity sold. Returnthese columns:The pro
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!