62 540
Assignments Done
98,7%
Successfully Done
In June 2018

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 ([]).
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions