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

Create a dynamic array of 100 integer values named myNums. Use a pointer variable (like ptr) which points to this array. Use thi

s pointer variable to initialize the myNums array from 2 to 200 and then display the array elements. Delete the dynamic array myNums at the end. You just need to write part of the program.
Computers and Technology
1 answer:
11111nata11111 [884]3 years ago
5 0

Answer:

The required part of the program in C++ is as follows:

int *ptr;

int *myNums = new int(100);

srand (time(NULL));

for (int i = 0; i < 100; i++) {

 myNums[i] = rand() % 200 + 2; }

ptr = myNums;

cout << "Output: ";

for (int i = 0; i < 100; i++) {

 cout <<*(ptr + i) << " "; }

delete[] myNums;

Explanation:

This declares a pointer variable

int *ptr;

This declares the dynamic array myNums

int *myNums = new int(100);

This lets the program generate different random numbers

srand (time(NULL));

This iterates through the array

for (int i = 0; i < 100; i++) {

This generates an integer between 2 and 200 (inclusive) for each array element

 myNums[i] = rand() % 200 + 2; }

This stores the address of first myNums in the pointer

ptr = myNums;

This prints the header "Output"

cout << "Output: ";

This iterates through the pointer

for (int i = 0; i < 100; i++) {

Print each element of the array, followed by space

 cout <<*(ptr + i) << " "; }

This deletes the dynamic array

delete[] myNums;

You might be interested in
Html is a markup language that lets you identify common sections of a web page
Alenkinab [10]

False, this statement is not correct. Hyper Text Markup Language, or HTML. It is a common markup language used to create web pages. Using HTML elements, or the components that make up a web page, like tags and attributes, enables the construction and organization of sections, paragraphs, and connections.

Why HTML is a markup language?

HTML transforms the text inside them using markup. They identify it as a specific genre of writing (like bold, italic, underline etc). HTML is a language because, like other languages, it contains its own code words. Because of these factors, HTML is also known as markup language.

What is HTML used for?

The language used to describe the organization of Web pages is called HTML. Authors can publish online documents containing headings, text, tables, lists, images, etc. thanks to HTML. Click a button to quickly access internet content using hypertext links.

Learn more about HTML: brainly.com/question/15093505

#SPJ4

5 0
2 years ago
Your company is getting negative feedback on the current customer service process. It’s your job to make sure customers are happ
Andru [333]

Answer:

I would say the second one

Explanation:

it makes sense cause if you're able to fix the problem that's how. if not then the last one

4 0
3 years ago
All of the following are forms of verbal communication except
Radda [10]
B. hand gestures
these are not verbal.
4 0
3 years ago
Read 2 more answers
Which of the following are best practices that should be done in Photoshop before placing images in InDesign?
SSSSS [86.1K]
I’m pretty sure it’s C good luck luv
8 0
4 years ago
Imaging a computer is part of what phase of conversion?
grandymaker [24]
B. Because the computer can rearrange itself when it is in a phase of conversion
5 0
3 years ago
Other questions:
  • Exchanging which type of data uses the least bandwidth?
    14·1 answer
  • Under the guise of justice, some less scrupulous administrators may be tempted to ____________________, or hack into a hacker’s
    12·2 answers
  • How to remove info from a broken laptop and transfer?
    5·1 answer
  • Monochrome refers to the use of one color in various shades and tints
    6·1 answer
  • How to find determinant of ​
    15·1 answer
  • To use the AutoCalculate area, select the range of cells containing the numbers for a calculation you want to verify and then pr
    6·1 answer
  • Which of these terms is a design principle?
    7·1 answer
  • If a base class pointer, p, points to a derived class instance, and both base and derived classes have a method void doIt() whic
    14·1 answer
  • What is Annually Teachers Planner?​
    13·1 answer
  • The science of how an object reacts to its motion through air is called _______________. (12 letters)
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!