Can you please check and help with the following: (i really need help with secti
ID: 3558643 • Letter: C
Question
Can you please check and help with the following:(i really need help with section 2 and 3)
2.Write appropriate statements for displaying the 1st, 3rd, and 7th elements of the following arrays that are declared as follows:
int grades[20]
double prices[10];
double amps[16];
int dist[15];
double velocity[25];
double time[100];
3.Using the cin object, write individual statements that can be used to enter values into the 1st, 3rd, and 7th elements of each of the arrays declared in 2.
4.Write array declarations, including initializers, for the following:
const grades=10;
String [grades]= {
Explanation / Answer
1.)
You've got the first one correct!
2.)
cout<<grades[0], cout<< grades[2], cout<<grades[6]
cout<<prices[0], cout<<prices[2], cout<<prices[6]
cout<<amps[0], cout<<amps[2], cout<<amps[6]
cout<<dist[0], cout<<dist[2], cout<<dist[6]
cout<<velocity[0], cout<<velocity[2], cout<<velocity[6]
cout<<time[0], cout<<time[2], cout<<time[6]
3.)
cin>>grades[0], cin>>grades[2], cin>>grades[6]
cin>>prices[0], cin>>prices[2], cin>>prices[6]
cin>>amps[0], cin>>amps[2], cin>>amps[6]
cin>>dist[0], cin>>dist[2], cin>>dist[6]
cin>>velocity[0], cin>>velocity[2], cin>>velocity[6]
cin>>time[0], cin>>time[2], cin>>time[6]
4.)
1.
int grades[10] = {89, 75, 82, 93, 78, 95, 81, 88, 77, 82};
2.
double amount[5] = {10.62, 13.98, 18.45, 12.68, 14.76};
3.
double interest_rate[100] = {6.29, 6.95, 7.25, 7.35, 7.40, 7.42};
(for the remaining 94 rates, take user-input)
for(int i=0; i<94; i++)
cin>>interest_rate[6+i];
4.
double temperatures[64] ={78.2, 69.6, 68.5, 83.9, 55.4, 67.0, 49.8, 58.3, 62.5, 71.6};
(for the remaining 54 rates, take user-input)
for(int i=0; i<54; i++)
cin>>temperatures[10+i];
5.
char letters[15] = {'f', 'j', 'm', 'q' , 't' , 'w' , 'z'}
(for the remaining 8 rates, take user-input)
for(int i=0; i<8; i++)
cin>>letters[7+i];