Answer to Question #71513 in C++ for Victoria

Question #71513
Hello, someone could help me with this exercise it's about Reading numbers: Write a program that reads a group of 10 numbers from the
user and place them inside a float type array. Once the numbers are
stored in the array, the program must calculate the average of these numbers and must
print the result on the screen. Use only pointer notation. For this one
exercise, it is forbidden to access the indexes by means of square brackets ([]).
1
Expert's answer
2017-12-04T14:18:07-0500
#include<iostream>
using namespace std;

int main(int argc, char* argv[])
{
float arr[10],avrg=0;
cout<<"Enter 10 numbers:"<<endl;
for(int i=0;i<10;i++)
{
cin>>*(arr+i);
avrg+=*(arr+i);
}
avrg/=10;
cout<<"Average of numbers is "<<avrg<<endl;

return 0;
}

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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS