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
zvonat [6]
3 years ago
10

Define a function roll() that takes no arguments, and returns a random integer from 1 to 6. Before proceeding further, we recomm

end you write a short main method to test it out and make sure it gives you the right values. Comment this main out after you are satisfied that roll() works.
Computers and Technology
1 answer:
Lostsunrise [7]3 years ago
6 0

Answer:

Follows are the code to this question:

#include <iostream>//defining a header file

using namespace std;

int roll()//defining a method roll

{

return 1+(rand() %5);//use return keyword that uses a rand method

}

int main()//defining main method

{

cout<<roll();//calling roll method that print is value

return 0;

}

Output:

4

Explanation:

In this code,  the "roll" method is defined, that uses the rand method with the return keyword, that returns the value between 1 to 6, and in the next step, the main method is declared, that uses the print method to calls the roll method.

You might be interested in
Given public class Fishing { byte b1 = 4; int i1 = 123456; long L1 = (long) i1; //Line A short s2 = (short) i1; //Line B byte b2
Aleksandr [31]

Answer:

Line E.

Explanation:

The  given program is as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = b1 + 7;     //Line E

   }

In the above code Line E will not compile and give following compilation error:

error: incompatible types: possible lossy conversion from int to byte

This error is coming because in Java b1 + 7 will be interpreted as int variable expression. Therefore in order to make code of Line E work the expression should be type casted as byte.  

The correct code will be as follows:

public class Fishing {

   byte b1 = 4; int i1 = 123456; long L1 = (long) i1;   //Line A

   short s2 = (short) i1;     //Line B

   byte b2 = (byte) i1;     //Line C

   int i2 = (int)123.456;    //Line D

   byte b3 = (byte)(b1 + 7);     //Line E

   }

5 0
3 years ago
What are some of the general components of an IDE?
AysviL [449]

Answer:

An IDE normally consists of a source e editor, build automation tools. Most modern IDEs have intelligent code completion. Some IDEs contain a compiler, interpreter, or both.

5 0
3 years ago
Which site had a major influence on the social gaming site Friendster?
Oduvanchick [21]
The answer is, "Ryze".
4 0
3 years ago
Read 2 more answers
The tcp/ip ____ layer commonly uses the transmission control protocol (tcp) to maintain an error-free end-to-end connection.
aleksklad [387]
The answer would be the TCP/IP Application Layer.
6 0
3 years ago
A technician who is managing a secure B2B connection noticed the connection broke last night. All networking equipment and media
pashok25 [27]

Answer:

<u>d. CRL</u>

<u>e. OCSP</u>

Explanation:

Note, the term PKI stands for Public Key Infrastructure.

Among all the PKI components, the CRL (CERTIFICATE REVOCATION LISTS), which contains a list of issued certificates that were later revoked by a given Certification Authority, and the PFX format used for storing server certificates should be examined by the technician use to validate his assumption.

7 0
3 years ago
Other questions:
  • True or False
    10·2 answers
  • 1. What is the central idea of the section "Service Record." Use two text details to
    8·1 answer
  • You are having trouble closing a program. You have tried to hit the Close button, the keyboard shortcut to close the program, an
    6·1 answer
  • Gini is a manager at a website design firm. She has a timeline prepared for the product to be delivered to the client. She needs
    6·2 answers
  • Assume phrase= "Peter Piper picked a peck of pickled peppers", What will be returned if phrase.search(/[aeiou]/) is called?
    9·1 answer
  • In an information systems framework, ________ is the bridge between the computer side on the left and the human side on the righ
    14·1 answer
  • We need an equals method for the Dog class. It needs to give back to the caller a boolean value indicating whether another objec
    5·1 answer
  • Most search engines provide specific pages on which you can search for____ and
    14·2 answers
  • This assignment will again take the form of a compare/contrast essay. You will use the fresco of Christ Teaching the Apostles in
    14·1 answer
  • What year did apple computer introduce the first ipod?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!