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

For any element in keysList with a value greater than 100, print the correspondi

ID: 3673810 • Letter: F

Question

For any element in keysList with a value greater than 100, print the corresponding value in itemsList, followed by a space. Ex: If keysList = {42, 105, 101, 100} and itemsList = {10, 20, 30, 40}, print:

Since keysList[1] and keysList[2] have values greater than 100, the value of itemsList[1] and itemsList[2] are printed.

#include <iostream>
using namespace std;

int main() {
const int SIZE_LIST = 4;
int keysList[SIZE_LIST];
int itemsList[SIZE_LIST];
int i = 0;

keysList[0] = 42;
keysList[1] = 105;
keysList[2] = 101;
keysList[3] = 100;

itemsList[0] = 10;
itemsList[1] = 20;
itemsList[2] = 30;
itemsList[3] = 40;

STUDENT SOULTION

cout << endl;

return 0;
}

Explanation / Answer

Code:

#include <iostream>
using namespace std;
int main() {
const int SIZE_LIST = 4;
int keysList[SIZE_LIST];
int itemsList[SIZE_LIST];
int i = 0;
keysList[0] = 42;
keysList[1] = 105;
keysList[2] = 101;
keysList[3] = 100;
itemsList[0] = 10;
itemsList[1] = 20;
itemsList[2] = 30;
itemsList[3] = 40;
for(i=0;i<SIZE_LIST;i++)// for loop to iterate through the items
{
if(keysList[i]>100) // checking whether the keysList[i] is greater than 100 or not
{
cout<<itemsList[i]<<" ";// if the keysList[i] is greater than 100,
//then print the corresponding element of itemsList
}
}
cout << endl;
return 0;
}

Output:

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