Question

Code In c++ Identify a problem that can efficiently be solved with the use of arrays...

  • Code In c++
  • Identify a problem that can efficiently be solved with the use of arrays (or vectors) and pointers.
  • Define the specifications for the program.
  • Write the program.
  • Summarize / communicate the use of arrays (or vectors) and pointers.
  • specifications, summary report,screenshots
  • Comments on code

Specifications:

define the specifications

Make sure you show your implementation of the use of arrays (or vectors) and pointers

  • Problem summary
  • Specifications
  • All source files
  • Report/summary as to the use of arrays (or vectors) and pointers.
  • Screen shot of the program running
0 0
Add a comment Improve this question Transcribed image text
Answer #1

C++ code:

#include<iostream>

using namespace std;

int main()

{

int a[100],n;

int *p=&a[0];

cout<<"Enter how many elements in array: ";

cin>>n;

cout<<"Enter arrray elements:";

for(int i=0;i<n;i++)//input array elements using pointer

{

cin>>*(p+i);

}

cout<<endl<<"array elements are:";

for(int i=0;i<n;i++)//printing array elements using pointer

{

cout<<*(p+i)<<" ";

}

int sum=0;

//sum using pointer

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

{

sum+=*(p+i);

}

cout<<endl<<"Sum of array elements:"<<sum<<endl;

}

output:

Add a comment
Know the answer?
Add Answer to:
Code In c++ Identify a problem that can efficiently be solved with the use of arrays...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT