PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, red indicates things in your output that shouldn't be there. The - character refers to newlines, so the green e character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 randArray[e ]- 65d 2 randArray[1 ]- 57d 3 randArray[2 ]- 39d 4 randArray[3 ]- 47d randArray[4 ]- 79d 6 randArray[5 ]- 59d 7 randArray[6 ]- 45d 8 randArray[7 ]- 11d 9 randArray[8 ]- 53d 10 randArray[9 ]- 27d 11 randArray[10 - 14 randArray[11 - 654 13 randArray[12 ]- 79d 14 randArray[13 15 randArray[14 - 82d randArray[15 - 784 12 764 16

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Getting an error with my code. Below I have included a screenshot 

Instruction:

DESCRIPTION
  • In main() for now: do these - one at a time, each in it's own loop (we will make functions out of them later

–Declare an array RandArray with 20 integers

–Assign each of the 20 values with a random value from 0 to 99

  • Hint: Use rand()%100
  • For mimir: Do not call srand at the top of main.

// normally: Call srand(time(0)) at the top of main

–(you need #include<cstdlib>)

–Write another loop that prints the array, with index values

Important:

If the output values do not match mimir, please add

srand(17); // inside your main function - at the top

My code:

#include <iostream>

using namespace std;

 

#include <cstdlib>

 

int main()

{

srand(17);

const int ARRAYSIZE = 20; // size for the array

int RandArray[ARRAYSIZE]; // array declared

 

int i; // to iterate the loop

 

// this loop will store the

// random numbers in the array

for (i = 0; i < ARRAYSIZE; i++)

RandArray[i] = rand() % 100;

 

// this loop will print the array

for (i = 0; i < ARRAYSIZE; i++)

cout << i << " = " << RandArray[i] << endl;

 

return 0;

}

PRETTY DIFF
This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, red
indicates things in your output that shouldn't be there.
The - character refers to newlines, so the green e character refers a newline you are missing in your output and the red refers to a newline you
need to remove from your output.
1 randArray[e ]- 65d
2 randArray[1 ]- 57d
3 randArray[2 ]- 39d
4 randArray[3 ]- 47d
randArray[4 ]- 79d
6 randArray[5 ]- 59d
7 randArray[6 ]- 45d
8 randArray[7 ]- 11d
9 randArray[8 ]- 53d
10 randArray[9 ]- 27d
11 randArray[10 - 14
randArray[11 - 654
13 randArray[12 ]- 79d
14 randArray[13
15 randArray[14 - 82d
randArray[15 - 784
12
764
16
Transcribed Image Text:PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, red indicates things in your output that shouldn't be there. The - character refers to newlines, so the green e character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 randArray[e ]- 65d 2 randArray[1 ]- 57d 3 randArray[2 ]- 39d 4 randArray[3 ]- 47d randArray[4 ]- 79d 6 randArray[5 ]- 59d 7 randArray[6 ]- 45d 8 randArray[7 ]- 11d 9 randArray[8 ]- 53d 10 randArray[9 ]- 27d 11 randArray[10 - 14 randArray[11 - 654 13 randArray[12 ]- 79d 14 randArray[13 15 randArray[14 - 82d randArray[15 - 784 12 764 16
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Assembly Language
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education