0
How to write a C++ program that retrieves all the numbers stored in a data file named Project?
As each number is retrieved, it is displayed on the screen. When the end of file is reached, the average of the numbers is displayed accurate to the nearest tenth. NOTE: Create a data file named Project and then copy and type the following numbers one 7 4 12 3 EXAMPLE: Given the numbers above, the output should be The average of 7 4 12 3 is 6.5
2 ответов
+ 3
program for average of six numbers.
int arr[6],avg;
for ( i=0;i<=5;i++)
{
cout << " enter number.";
cin>> arr[¡];
cout<<arr[i];
}
avg = (arr[0]+arr[1]+arr[2]+arr[3]+arr[4]+arr[5]) / 6
cout<<avg ;
0
what about the opening tge data file