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
Chances are if you ar Chances are, if you are involved in a crash, it will happen __________ a. during a long trip. b. close to
JulijaS [17]
During a long trip. Hope this helps!
6 0
3 years ago
Read 2 more answers
Find the domain and range of Y=x^3-9/x-3​
dmitriy555 [2]
847nduak388jejdidmenrf838484858686
6 0
3 years ago
What type of programing code do game developers use.
Eduardwww [97]

Explanation:

object oriented programming languages like C#, C++, Java are used by developers to develop a game.

8 0
3 years ago
A Linux-based OS is called a _____.
solong [7]
It is called kernel
7 0
3 years ago
write two paragraphs (at least 5 sentences each) about what President Biden and Vice-President Harris plan to do during the firs
frozen [14]

Answer:

writing one in comments bec i don't have time for both sorry

4 0
3 years ago
Other questions:
  • Which of the following has the responsibility of offering instruction on intrusion detection systems and intrusion prevention sy
    11·1 answer
  • Why people needs soft skills in the era of high technology.
    13·1 answer
  • Suppose a retailer who has no technology expertise wishes to set up an online presence for his business. He ________. a. ​can us
    6·1 answer
  • Using the College Registration example from Section 6.7.3 as a starting point, do the following:
    5·1 answer
  • The only type of donation you can make to a not for profit is to donate money
    10·1 answer
  • Memory is the place of the computer where data and instructions are stored either permanently or temporarily. True or false.​
    11·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Which of the following best describes the protocol used on the internet?
    8·1 answer
  • …….. and ……...are called binary digits. (Computer Science)
    13·2 answers
  • after landing, you are tying down the aircraft when a person approaches and asks: "faa. are you the pilot of this aircraft?" wha
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!