Answer:
#include <iostream>
#include <map>
using namespace std;
int main(){
map<string, double> destination;
string search;
char isEnd = 'n';
while (isEnd == 'n'){
string dest;
double tarrif;
cout<<"Enter destination: ";
cin>> dest;
cout<<"Enter tarrif: ";
cin>> tarrif;
destination.insert(pair<string, double>(dest, tarrif));
cout<<"Do you want to add more locations? y/n: ";
cin>> isEnd;
}
cout<<"Enter a search term: ";
cin>>search;
auto iter= destination.find(search);
cout<< "The tariff for "<<iter->first<<" is: "<<iter->second;
}
Step-by-step explanation:
The C++ source code provides the input prompt to fill the map data structure "destination". The structure contains data of mapped locations and tariffs. The program also prompts user to search for the tariff of their desired location, if the location is in the map, the tarrif is given else an error message is displayed.