Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Array Use Part A (Analyzing input) Write a program that reads ten numbers, compu

ID: 3621605 • Letter: A

Question

Array Use

Part A
(Analyzing input) Write a program that reads ten numbers, computes their average, and finds out how many numbers are above the average.




Part B
(Reversal of Strings) Write a Program that reads in a string from the user and prints it in reverse (i.e the user types “aggiepride” the program should print out “edirpeigga”). Hint: A string is an array of characters.


Part C
(Counting single digits) Write a program that generates one hundred random integers between 0 and 9 and displays the count for each number. Hint: Use (int)(Math.random() * 10) to generate a random integer between 0 and 9. Use an array of ten integers, say counts, to store the counts for the number of 0's, 1's, ..., 9's.

001
001
111
All 0's on row 0
All 1's on row 2
All 1's on column 2

Explanation / Answer

please rate - thanks

2 out of 3.

to be honest that last question sound like java

#include<iostream>
#include<string>
using namespace std;
int reverse( string & );
int main()
{string input;
int count;
cout<<"Enter a string: ";
getline(cin,input);
count=reverse(input);
cout<<" reversed the "<<count<<" letter string is: "<<input<<endl;
system("pause");
return 0;
}

int reverse(string& input)
{int i,j;
char temp;
for(j=0;input[j]!='';j++);
for(i=0;i<j/2;i++)
{temp=input[i];
input[i]=input[j-1-i];
input[j-1-i]=temp;
}
return j;
}

---------------------------------

#include <iostream>
using namespace std;
int main()
{int i, n[10], sum=0, count=0;
double average;
for(i=0;i<10;i++)
   {cout<<"Enter a number: ";
   cin>>n[i];
   sum+=n[i];
   }
average=sum/10.;
for(i=0;i<10;i++)
    if(n[i]>average)
         count++;
cout<<"There are "<<count<<" numbers greater than the average which is "<<
       average<<endl;
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote