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:20 30 Since keysList.at(1) and keysList.at(2) have values greater than 100, the value of itemsList.at(1) and itemsList.at(2) are printed.
#include <iostream>
#include <
using namespace std;
int main() {
const int SIZE_LIST = 4;
vector<int> keysList(SIZE_LIST);
vector<int> itemsList(SIZE_LIST);
unsigned int i;
for (i = 0; i < keysList.size(); ++i) {
cin >> keysList.at(i);
}
for (i = 0; i < itemsList.size(); ++i) {
cin >> itemsList.at(i);
}
/* Your solution goes here */
cout << endl;
return 0;
}
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
- The ListInterface defines two constructors.arrow_forward// Declare data fields: a String named customerName, // an int named numItems, and // a double named totalCost.// Your code here... // Implement the default contructor.// Set the value of customerName to "no name"// and use zero for the other data fields.// Your code here... // Implement the overloaded constructor that// passes new values to all data fields.// Your code here... // Implement method getTotalCost to return the totalCost.// Your code here... // Implement method buyItem.//// Adds itemCost to the total cost and increments// (adds 1 to) the number of items in the cart.//// Parameter: a double itemCost indicating the cost of the item.public void buyItem(double itemCost){// Your code here... }// Implement method applyCoupon.//// Apply a coupon to the total cost of the cart.// - Normal coupon: the unit discount is subtracted ONCE// from the total cost.// - Bonus coupon: the unit discount is subtracted TWICE// from the total cost.// - HOWEVER, a bonus coupon only applies if the…arrow_forward3. Which among the following shows a valid use of the Direction enumeration as a parameter to the moveCharacter function? Select al that apply. enum Direction { case north, south, west, east}func moveCharacter(x: Int, y: Int, facing: Direction) {// code here} moveCharacter(x: 0, y: 0, facing: .southwest) moveCharacter(x: 0, y: 0, facing: Direction.north) moveCharacter(x: 0, y: 0, facing: .south) moveCharacter(x: 0, y: 0, facing: Direction.northeast)arrow_forward
- text file 80 1 2 3 100 100 100 1001 0 2 100 3 4 100 1002 2 0 4 4 100 5 1003 100 4 0 100 100 4 100100 3 4 100 0 3 3 3100 4 100 100 3 0 100 1100 100 5 4 3 100 0 2100 100 100 100 3 1 2 0 My code below. I am getting an error when trying to create my adjacency matrix. i dont know what i am doing wrong def readMatrix(inputfilename): ''' Returns a two-dimentional array created from the data in the given file. Pre: 'inputfilename' is the name of a text file whose first row contains the number of vertices in a graph and whose subsequent rows contain the rows of the adjacency matrix of the graph. ''' # Open the file f = open(inputfilename, 'r') # Read the number of vertices from the first line of the file n = int(f.readline().strip()) # Read the rest of the file stripping off the newline characters and splitting it into # a list of intger values rest = f.read().strip().split() # Create the adjacency matrix adjMat = []…arrow_forwardWrite a code in python for this exercise belowarrow_forward3.)Declare variables a. The images variable containing an HTML collection of all elements with the tag name "img". b. The photoBucket variable referencing the element with the id "photo_bucket". c. The photoList variable referencing the element with the id "photo_list". 4.) Create a for loop that iterates through all of the items in the images collection. 5.) Within the for loop insert an onclick event handler that runs an anonymous function when an image is clicked. 6.) When an image is clicked it is either moved from the photo bucket to the photo list or from the photo list back to the photo bucket. To determine which action to perform, add the following if else statement to the anonymous function: a. If the parent element of the clicked image has an id equal to "photo_bucket" then do the following: (i) Create an element node named newltem for the li element, (ii) append newltem to the photoList object, and (i) append the image to the newltem object using the appendChild() method.…arrow_forward
- POEM_LINE = str POEM = List[POEM_LINE] PHONEMES = Tuple[str] PRONUNCIATION_DICT = Dict[str, PHONEMES] def all_lines_rhyme(poem_lines: POEM, lines_to_check: List[int], word_to_phonemes: PRONUNCIATION_DICT) -> bool: """Return True if and only if the lines from poem_lines with index in lines_to_check all rhyme, according to word_to_phonemes. Precondition: lines_to_check != [] >>> poem_lines = ['The mouse', 'in my house', 'electric.'] >>> lines_to_check = [0, 1] >>> word_to_phonemes = {'THE': ('DH', 'AH0'), ... 'MOUSE': ('M', 'AW1', 'S'), ... 'IN': ('IH0', 'N'), ... 'MY': ('M', 'AY1'), ... 'HOUSE': ('HH', 'AW1', 'S'), ... 'ELECTRIC': ('IH0', 'L', 'EH1', 'K', ... 'T', 'R', 'IH0', 'K')} >>> all_lines_rhyme(poem_lines, lines_to_check, word_to_phonemes) True…arrow_forwardIn Kotlin, 4.Create a list of Ints from 1 to 25 Use map() with the list and your area function to create a list of the areas of circles with each of the Ints as radiusarrow_forwardDescription:Create JFrame application called Dictionary.Set up three one-dimensional arrays to contain the equivalent English andother-language-of-your-choice nouns, and the images of those objects.Typing a word in one of the languages and hitting the appropriate buttonshould produce the translation and display the picture of that object. Makesure you check to see whether the word is in the dictionary. If it is not,display a message "Word is not found".Three arrays will be of equal length (array_length).The program should work for different array_length values. Test andupload for array_length = 10.Requirements: This project requires typing a word in one of the languages. So, theprogram should be interactive. The word search should be case-insensitive. Three arrays must be declared: two String arrays for words in twolanguages and the third array for pictures files names. List of words in dictionary should be displayed for user With arrays, use for or enhanced for loop. Enhanced for…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education