#pragma warning(disable: 4786)
#include
#include
#include
using namespace std;
int main() {
map
// Assign keys and values
ass_array["fat"] = 0;
ass_array["sodium"] = 45;
ass_array["totalcarb"] = 46;
ass_array["protien"] = 0;
// Insert Value
ass_array.insert( map
// Print value of sodium
cout << ass_array["sodium"] << endl;
cout << "The map has " << ass_array.size() << " entries.\n";
// Iterator used to hold position in the map
map
// Returns same value as ass_array.end() if not find.
loc = ass_array.find("sugar");
if(loc != ass_array.end())
cout << "Sugar found!\n";
else
cout << "No Sugar\n";
return 0;
}
No comments:
Post a Comment