Page 1 of 1

USING MAP please let me know if you have any questions THIS IS ALL THE INFORMATION GIVEN :(

Posted: Fri Jul 08, 2022 6:38 am
by answerhappygod
USING MAP
Using Map Please Let Me Know If You Have Any Questions This Is All The Information Given 1
Using Map Please Let Me Know If You Have Any Questions This Is All The Information Given 1 (298.56 KiB) Viewed 39 times
Using Map Please Let Me Know If You Have Any Questions This Is All The Information Given 2
Using Map Please Let Me Know If You Have Any Questions This Is All The Information Given 2 (211.39 KiB) Viewed 39 times
please let me know if you have any questions
THIS IS ALL THE INFORMATION GIVEN :(
#include "wrapper.h" #include "CarRecord.h" #include "map\map1.hpp" class vinComparer { public: static Boolean areEqual (Text& lhs, Text& rhs) //! restores lhs, rhs { return (1hs == rhs); }; // areEqual }; Using Map // Key = Text = car VIN // Value = CarRecord typedef Mapl CarMap; int main(int argc, char* argv[]) CarMap mel, mc2; CarRecord carRec; Text vin, vinCopy; Integer z; Boolean b; carto "INCR // Comment: To make this activity more interesting, Map mcl is 'seeded' // with 3 mappings listed below. // Normally it would be empty just after declaration and would be written as follows: // mc1 = { } // A real vin looks like this: WMWRH335X7TJ43830 // But we will use the 1st 3 characters: "WMW" Last Updated: 2/27/2017 // Each tuple in the map is a (k, v) pair. // k = vin //v = CarRecord mc1 = ("WMW", ("WMW", "Mustang", 2, "Yellow", 2012)), ("WBA", ("WBA", "Accord", 4, "Silver", 2005)), ("2G1", ("2G1", "A6", 3, "Orange", 2011)) carRec = ("","",0,"",0) z = 0 vin = vinCopy b = false; **** WHE
Boolean b; carRec.vin = "1HG"; carRec.name = "Charger"; carRec.numberOfDoors = 2; carRec.color = "Red"; carRec.yearManufactured = 2009; vin carRec.vin; mcl.add (vin, carRec); z = mcl.size(); carRec.vin = "19V"; carRec.name = "Acura ILX"; carRec.numberOfDoors = 4; carRec.color="Black"; carRec.yearManufactured = 2013; vin carRec.vin; mcl.add (vin, carRec); vin = "WBA"; bmcl.hasKey (vin); vin = "EK7"; b= mc1.hasKey (vin); vin = "WMW"; mc1.remove (vin, vinCopy, carRec); vin="2G1"; wcout <