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
DENIUS [597]
3 years ago
12

Write a program that defines an array of integers and a pointer to an integer. Make the pointer point to the beginning of the ar

ray. Then, fill the array with values using the pointer (Note: Do NOT use the array name.). Enhance the program by prompting the user for the values, again using the pointer, not the array name. Use pointer subscript notation to reference the values in the array.
Computers and Technology
1 answer:
Reptile [31]3 years ago
3 0

Answer:

#include<iostream>

using namespace std;

int main()

{

  int a[20],n;

  int *p;

  cout<<"\n enter how many values do you want to enter:";

  cin>>n;

  for(int i=0;i<n;i++)

  {

      cout<<"\n Enter the "<<i+1 <<"th value :";

      cin>>*(p+i);

      //reading the values into the array using pointer

  }

  cout<<"\n The values in the array using pointer is:\n";

  for(int i=0;i<n;i++)

  {

      cout<<"\n (p+"<<i<<"): "<<*(p+i);

      //here we can use both *(p+i) or p[i] both are pointer subscript notations

  }

}

Output:

You might be interested in
Consider the pseudo-cpu discussed in class. the instruction format is 16 bits, which is subdivided into 4-bit opcode field and 1
sp2606 [1]
I need a picture or an answer choice
6 0
4 years ago
What is the value of the cost variable after the following code snippet is executed? int cost = 82; if (cost &lt; 100) { cost =
KonstantinChe [14]

Answer:

184

Explanation:

Given the codes

  1.        int cost = 82;
  2.        if (cost < 100)
  3.        {
  4.            cost = cost + 10;
  5.        }
  6.        if (cost > 50)
  7.        {
  8.            cost = cost * 2;
  9.        }
  10.        if (cost < 100)
  11.        {
  12.            cost = cost - 20;
  13.        }

The initial value of cost is 82.

The if condition in Line 3 will pass and therefore cost = 82 + 10 = 92

The if condition in Line 8 will pass and therefore cost = 92 * 2 = 184

The if condition in Line 13 will fail l and therefore the if block will be skipped.

At last, the we get cost = 184.

8 0
3 years ago
MULTIPLE CHOICE!!!
kolbaska11 [484]
The answer is a) you
8 0
4 years ago
Read 2 more answers
A column to be used in a database is called the
Temka [501]

it is called an attribute

8 0
3 years ago
Why do you lose internet access when you alter the arp to a static address?
Mila [183]
Sometimes you lose internet access because by altering the arp to a static address, there is change during that so u usually lose the i internet access [ hope i’m right ]
6 0
3 years ago
Read 2 more answers
Other questions:
  • Common icons found on the Windows desktop are _____.
    6·2 answers
  • Before desktop computers made italic fonts available in the home and office, writers used underlining to:
    12·1 answer
  • What does JPEG stand for?
    15·2 answers
  • In a stream channel what is deposited first?
    7·1 answer
  • How did the new technologies of WWI affect soldiers fighting on the front lines? Please include at least three examples of new t
    5·1 answer
  • Why does my inbox keep getting notifications and then disappearing?
    15·2 answers
  • How do you import an SVG file?
    12·1 answer
  • The compound known as butylated hydroxytoluene, abbreviated as BHT, contains carbon, hydrogen, and oxygen. A 1.501 g sample of B
    11·1 answer
  • Keely has an automation tool in place that runs a number of different processes for her and has for the last two years. All of a
    8·1 answer
  • Josh recorded a podcast for his Civics class project. Which file type will allow him to save his file?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!