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
liubo4ka [24]
4 years ago
3

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to

print two random integers between 0 and 9. End with a newline. Ex:
5
7
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activ
Computers and Technology
1 answer:
snow_tiger [21]4 years ago
3 0

Answer:

The C++ code is given below with appropriate comments

Explanation:

//Use stdafx.h for visual studio.

#include "stdafx.h"

#include <iostream>

//Enable use of rand()

#include <cstdlib>

//Enable use of time()

#include <ctime>

using namespace std;

int main()

{

    //Note that same variable cannot be defined to two

    //different type in c++

    //Thus, use either one of the two statement

    //int seedVal=0;time_t seedVal;

    //int seedVal=0;

    time_t seedVal;

    seedVal = time(0);

    srand(seedVal);

    //Use rand to generate two number by setting range

    // between 0 and 9. Use endl for newline.

    cout << (0 + rand() % ((10 - 0) + 0)) << endl;

    cout << (0 + rand() % ((10 - 0) + 0)) << endl;

    //Use for visual studio.

    system("pause");

    return 0;

}

You might be interested in
Hey plz help me with this<br>What is malware short for?​
soldier1979 [14.2K]

Answer:

Malware is the collective name for a number of malicious software variants, including viruses, ransomware and spyware. Shorthand for malicious software, malware typically consists of code developed by cyberattackers.

Explanation:

4 0
3 years ago
If you want to present slides to fellow students or co-workers,which productivity software should you use to create them?
Tamiku [17]
Just use prezi.com hope that helps.
6 0
4 years ago
Read 2 more answers
Would an artificial intelligence come into existence anytime in the next 30 years?
Scrat [10]
Artificial Intelligence, based on neural networks, is available now.
4 0
3 years ago
Copyrighted software illegally downloaded and sold by organized groups without a license to do so is called:
trasher [3.6K]
Copyrighted software illegally downloaded and sold by organized groups without a license is called Warez
5 0
3 years ago
Go follow me plz i would appreciate it
aleksandr82 [10.1K]
Hejdjxuxudjjdjdbdbdbd
6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is a goal of paraphrasing​
    12·1 answer
  • Host to IP address lookup and its reverse lookup option are very important network services for any size network. It is also how
    14·1 answer
  • (Complete the Problem-Solving discussion in Word for Programming Challenge 2 on page 404. Your Problem-Solving discussion should
    13·1 answer
  • 4.2: Roman Numeral Converter
    9·1 answer
  • A research team is studying parallel computing. They want to run parallel process without having to use multiple processors. How
    7·1 answer
  • Which option ensures that a page break is automatically inserted ahead of a specific paragraph or heading?
    10·2 answers
  • Kelly is a college sophomore majoring in computer science. She is interested in gaining exposure to the most useful and current
    13·1 answer
  • Write a technical term for following statements
    15·1 answer
  • Guys im getting the ps5 tomorrow :)​
    5·2 answers
  • Flash drive / USB is ___________ device. A)Input B)Output C)Internal D)None of these
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!