Given the following set of code, select all C++ expressions: #include #include #include #include "grocery_list_lib.h" // Returns an array of pair objects of item and amount std::array> amount ; grocery_list[i].second = amount; } return grocery_list; } Ogrocery_list[i].first Ostd::string item; item_amount return grocery_list; double>, 5> create_grocery_list (){ double>, 5> grocery_list; "Enter item: "

icon
Related questions
Question
Given the following set of code, select all C++ expressions:
4₁
#include <iostream>
#include <sstream>
#include <vector>
#include "grocery_list_lib.h"
// Returns an array of pair objects of item and amount
std::array<std::pair<std::string, double>, 5> create_grocery_list (){
std::array<std::pair<std::string, double>, 5 grocery_list;
std::string item;
std::string item_amount;
F3
double amount;
for(int i = 0; i < 5; i++){
std::cout << "Enter item: "
getline(std::cin, item);
grocery_list[i].first = item;
getline(std::cin, item_amount);
std::stringstream(item_amount) >> amount
grocery_list[i].second = amount;
}
return grocery_list;
}
grocery_list[i].first
std::string item;
item_amount
return grocery_list;
"Enter item:
$
4
4)
R
Q Search
DII
%
5
T
F5
6
LO
F6
Y
F7
&
7
U
BO
PrtScn
F8
8
Home
F9
9
End
F10
Po
0
Transcribed Image Text:Given the following set of code, select all C++ expressions: 4₁ #include <iostream> #include <sstream> #include <vector> #include "grocery_list_lib.h" // Returns an array of pair objects of item and amount std::array<std::pair<std::string, double>, 5> create_grocery_list (){ std::array<std::pair<std::string, double>, 5 grocery_list; std::string item; std::string item_amount; F3 double amount; for(int i = 0; i < 5; i++){ std::cout << "Enter item: " getline(std::cin, item); grocery_list[i].first = item; getline(std::cin, item_amount); std::stringstream(item_amount) >> amount grocery_list[i].second = amount; } return grocery_list; } grocery_list[i].first std::string item; item_amount return grocery_list; "Enter item: $ 4 4) R Q Search DII % 5 T F5 6 LO F6 Y F7 & 7 U BO PrtScn F8 8 Home F9 9 End F10 Po 0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer