64 491
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #39111 in C++ for Verasak Sitawan

Question #39111
Write C++ program that declares an array of 10 integers. Write a loop that accepts 10
values from the keyboard, and write another loop that displays the 10 values. Do not
use any subscripts within the two loops; use pointers only.
Expert's answer
#include <iostream>
#include <stdlib.h>

using namespace std;

int main (void)
{
const int SIZE = 10;
int array[SIZE];
cout << "Enter " << SIZE << " numbers:" << endl;
for (int *p = array; p < array + SIZE; ++p)
{
cin >> *p;
}
cout << endl << "The numbers:" << endl;
for (int *p = array; p < array + SIZE; ++p)
{
cout << *p << endl;
}
system("pause");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions