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
Leni [432]
3 years ago
12

Implement RandMultipByVal function, which gets one integervariable as its argument

Computers and Technology
1 answer:
Kitty [74]3 years ago
7 0

Answer:

#include <iostream>

#include <stdlib.h>

#include <time.h>

using namespace std;

void RandMultipByVal(int number){

   srand(time(NULL));

   int random = rand()%10+1;

   cout<<random*number;

}

int main()

{

 

  RandMultipByVal(4);

  return 0;

}

Explanation:

Include the three libraries, iostream for input/output, stdlib.h for rand() function and time.h for srand() function.

Create the function with one integer parameter.

Then, use srand() function. It is used to seed the rand() function or locate the starting point different in different time.

rand(): it is used to generate the random number between the range.

for example:

rand()%10  it gives the random number from 0 to 9.

if we add 1, then it gives from 1 to 10.

After that, multiply with parameter value and then print the result.

For calling the function create the main function and call the function with pass by value.

You might be interested in
Under the Home tab, where can a user find options to change the bullet style of an outline?
fomenos
Created a new multilevel list style to add to the gallery
5 0
3 years ago
Match the following:
Bogdan [553]

Answer:

  1. Operating System.
  2. Laptop.
  3. Convertible computer.
  4. Peripheral.
  5. Desktop Computer.

Explanation:

Operating system is a software that manages the hardware and the software in the system and provides the interface between machine and the user.

Laptops are the portable computing devices which you can carry with you.

Convertible computer have a keyboard that is detachable and can be converted into a tablet.

Peripherals are devices which we can attach to the computer.

Desktop computer is a computing device that not portable at all.

3 0
3 years ago
A shop will give discount of 10% if the cost of purchased quantity is more than 1000. Ask user for quantity suppose, one unit wi
Mamont248 [21]

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int qty;

   float discount = 0;

   cout<<"Quantity: ";

   cin>>qty;

   int cost = qty * 100;

i f (cost > 1000) {        discount=cost * 0.10;        }

   cout<<"Cost: "<<cost - discount;

   return 0;

}

Explanation:

This declares the quantity as integer

   int qty;

This declares and initializes discount to 0

   float discount = 0;

This prompts the user for quantity

   cout<<"Quantity: ";

This gets input for quantity

   cin>>qty;

This calculates the cost

   int cost = qty * 100;

If cost is above 1000, a discount of 10% is calculated

i f (cost > 1000) {        discount=cost * 0.10;        }

This prints the cost

   cout<<"Cost: "<<cost - discount;

4 0
3 years ago
Different between embedded computer &amp;<br> Micro controllers
Eduardwww [97]

An embedded computer is a product that uses a microprocessor as a component. Ie a relationship between a car and its engine. A Microcontroller is a microprocessor that is packaged with RAM, program storage and interface circuitry to make it simple to use

6 0
2 years ago
Suppose that a minus sign in the input indicates pop the stack and write the return value to standard output, and any other stri
Sergio [31]
It’s b just really got to make since an read it right that’s all
7 0
3 years ago
Read 2 more answers
Other questions:
  • What type of malicious procedure involves using sniffing tools to capture network communications to intercept confidential infor
    7·1 answer
  • Allie needs to add a long row of numbers. She should enter a
    13·2 answers
  • A technician, joe, has replaced a faulty 500 gb hard drive in a pc system with a 1 tb hard drive. however, after the replacement
    10·1 answer
  • What are three ways you cite evedince
    5·2 answers
  • Based on your research and understanding, write a 3- to 4-page Microsoft Word document that:
    11·1 answer
  • List and describe the tools for all the main stages of app/application development.
    11·1 answer
  • Design and implement an application that plays the Hi-Lo guessing game with numbers. The program should pick a random number bet
    13·1 answer
  • You will be creating a quiz grading program. You will compare the student's answers with the correct answers, and determine if t
    15·1 answer
  • Energy requirements of analog and digital signals.
    11·2 answers
  • Your task is to build a palindrome from an input string.A palindrome is a word that readsthe same backward or forward. Your code
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!