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
miss Akunina [59]
3 years ago
15

Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline.

Computers and Technology
1 answer:
blondinia [14]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   cout<< rand() % 50 + 100 <<endl;

   cout<<rand() % 50 + 100 <<endl;

   

   return 0;

}

Explanation:

The rand() gives you a random number. If you use rand() % 50, it will give you a random number between 0 and 49. Since we are required to have the numbers between 100 and 149, add 100 to this expression. This way, you will have a random number between 100 and 149. Type this expression two times and use "endl" to end with a new line.

You might be interested in
Show the steps of a Selection Sort for the numbers ( 5 3 9 5 ).
Sedbober [7]

Answer:

Sorted array will be:-

3 5 5 9

Explanation:

In Selection Sort algorithm it sorts the array by repeatedly finds the minimum in the array form the array that is unsorted and swaps it with the value at the first position.

The unsorted array:- 5 3 9 5

In first iteration

minimum is 3.

3 will be swapped with 5.

Now the array is 3 5 9 5

sorted array 3

In second iteration

unsorted array is 5 9 5

sorted array 3 5

and the minimum from it is 5

No swapping will occur.

In third iteration

unsorted array is 9 5

minimum is 5

sorted array 3 5 5

swap it with 9.

Now the array is sorted.

3 5 5 9

3 0
3 years ago
Why would you convert your birth year to binary numbers?
I am Lyosha [343]

Answer:

Write out your birthday in the following format: M/DD/YY. For example, if your birthday is on June 11, 2013, it would be written as 6/11/13.

2. Convert the birthday date to binary format. Using our same example from above, 6/11/13 translated into binary code would be: 110/1011/1101.

3. Select one color of bead to represent “0”, a second color to represent “1” and then the third color to represent a space (/) between the numbers.

4. Layout the beads to represent your birthdate in binary code. Don’t forget the third color for the spaces in between the numbers!

5. Once laid out, string all the beads on to the string or pipe cleaner.

6. Tie a knot around the ends and enjoy your one-of-a kind masterpiece as a piece of jewelry or a bag tag….the options are endless!

6 0
3 years ago
4. Where do you find the command to create bibliography citations or a table of contents?
Mrac [35]

Answer:

the answer is quick access toolbar

4 0
2 years ago
Read 2 more answers
Question 12
AlladinOne [14]

Which is a multicast address ?

ans: 241.2.2.1

6 0
2 years ago
write a program that keeps names and email addresses in a dictionary as key-value pairs. the program should display a menu that
erma4kov [3.2K]

To write a program that keeps names and email addresses in a dictionary as key-value pairs check the code given below.

<h3>What is key-value pairs?</h3>

In a key-value pair, two related data elements are combined: a value, which is a variable that belongs to the set (for example, male/female, green, 100), and a key, which is a constant that defines the data set (for example, gender, color, price).

A key-value pair could look something like this when fully formed:

gender = male

color = green

price > 100

↓↓↓//<u>Python code</u>//↓↓↓

import pickle

import sys

try:

   f=open('email.dat','rb')

   d=pickle.load(f)  

   f.close()

     

except:    

   d={}

while True:

   print('\n1. Find a email address')

   print('2. Add name and email address')

   print('3. Change an email address')

   print('4. Delete an email address')

   print('5. Exit\n')

   choice=input('\nEnter a choice: ')

   if choice:

       choice=int(choice)

   else:

       print('\nEnter a number')

       continue    

   if choice == 1:

       while True:

           name=input('\nEnter the name ')

           if name:

               if name in d:

                   print('\n%s is the email id of %s \n' % (d[name],name))

                   break

               else:

                   print('\n Email not found \n')

                   break

           else:

               print('\nName cannot be empty\n')

               continue

           

   elif choice==2:

       while True:            

       

           name=input('\nEnter the name ')

           if name:

               break;

           else:

               print('\nName cannot be empty \n')

               continue

       while True:            

       

           email=input('\nEnter the email address ')

           if email:

               d[name]=email

               break

           else:

               print('\nEmail cannot be empty\n')

               continue

           

   elif choice==3:

       while True:            

       

           name=input('\nEnter the name to change the email address ')

           if name:

               if name in d:

                   email=input('\nEnter the new email address ')

                   d[name]=email

                   print('\nEmail address changed \n')

                   break;

               else:

                   print('\nName not found \n')

                   break

           else:

               print('\nName cannot be empty \n')

               continue

           

   elif choice == 4:

       while True:            

       

           name=input('\nEnter the name to remove ')

           if name:

               if name in d:

                   del d[name]

                   print('\nName and Email address removed \n ')

                   break;

               else:

                   print('\nName not found \n')

                   break

           else:

               print('\nName cannot be empty\n')

               continue

   elif choice == 5:

       

       f=open('email.dat','wb')

       pickle.dump(d,f)

       f.close()

       sys.exit()

   else:

       print('\nEnter a valid choice ')    

Learn more about key-value pair

brainly.com/question/29414672

#SPJ1

3 0
1 year ago
Other questions:
  • You are logged in as a user with limited system privileges, you are the linux system administrator and you have the password to
    5·1 answer
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • You wrote a C application that takes 20 seconds using your desktop processor. An improved C compiler is released that requires o
    6·1 answer
  • What characters cannot be used in a filename?
    15·1 answer
  • In a gear system, when you gain torque you lose what?
    11·1 answer
  • What do u mean by generation of computer
    12·1 answer
  • What is the main function of processing unit​
    5·2 answers
  • What is HDLC flow control?​
    6·1 answer
  • I will give brainliest to the best answer. what is a good screen recorder
    11·1 answer
  • How to print something nad input on same line python
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!