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
All of the following are types of goals listed in the course except?
zloy xaker [14]
A. Financial, because the rest seem to be health related.
4 0
3 years ago
Read 2 more answers
Longitud de un circulo​
const2013 [10]

Answer:

circunferencia (o perímetro de una circunferencia) L es igual a dos veces el radio (r) por π, o lo que es lo mismo, el diámetro (D) de la circunferencia porπ. ... El concepto “longitud de una circunferencia” es igual al del “perímetro del círculo” y miden lo mismo.

5 0
3 years ago
When learning to code, it is helpful to take a trial and error approach to write code—write it, review messages, and write again
elena55 [62]

Answer:

Its True

Explanation:

8 0
3 years ago
Which of these is a consequnce of removing a method declaration from an interface after it has been implemented?a. There are no
user100 [1]

Answer:

Option (a)

Explanation:

It will not produce any error as if a function is declared in the interface and then implemented by a class same function can be defined, but if that declaration is removed then also that class will consider that method as new declaration and it won't produce any type of error. For example : if following code of Java  is run -

interface printing{  

   void print_it();   //method declared

   }  

class Student implements printing{  

public void print_it()    //method implemented

{

   System.out.println("Hello World");

}      

public static void main(String args[]){  

Student obj = new Student();  

obj.print_it();    //method called

   }  

}

OUTPUT :

Hello world

But if the program is altered and declaration of print_it is deleted from the interface like following :

interface printing{  

//method is removed from here

   }  

class Student implements printing{  

public void print_it()    //method implemented

{

   System.out.println("Hello World");

}      

public static void main(String args[]){  

Student obj = new Student();  

obj.print_it();    //method called

   }  

}

Still no error is generated and same output is displayed as before.

8 0
2 years ago
To ensure that any _____________ are detected, frames are made large enough to fill the entire cable during transmission.​
givi [52]
<span>To ensure that any collisions are detected, frames are made large enough to fill the entire cable during transmission</span>
4 0
2 years ago
Other questions:
  • Which magazine can help public determine best technology to buy
    12·1 answer
  • In c++
    9·1 answer
  • "what are the problems with tcp over wireless network?"
    15·1 answer
  • Which part is the author’s address?
    5·1 answer
  • Which advertising medium has the widest reach on a global front?
    12·1 answer
  • Danica is creating a flyer for her cookies that she will sell during her school fair. She wants to add a registered
    7·1 answer
  • What explains the discrepancy between the number of bytes you can
    13·1 answer
  • The numeric keys on a keyboard or calculator are referred to as a:
    10·1 answer
  • Pls help me computer science discoveries
    5·1 answer
  • The first version of Windows to have automatic updates from the Internet was _____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!