I am writing my first STL program in C++, and I am facing this issue.
This is my program :
#include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
int n,m;
// n : number of file extenstions
// m : number of filenames to identify
string extension, type, filename;
cin >> n >> m;
unordered_map<string,string> hashmap;
while(n--)
{
cin >> extension >> type;
hashmap.insert(make_pair<string,string>(extension,type));
}
while(m--)
{
cin >> filename;
extension = filename.substr(filename.find_last_of('.')+1);
cout << extension << endl;
}
}
My input file is :
5 6
html text/html
htm text/html
png image/png
svg image/svg+xml
txt text/plain
index.html
this.file.has.lots.of.dots.txt
nodotsatall
virus.exe
dont.let.the.png.fool.you
case.matters.TXT
I am getting error : no matching function for call to ‘make_pair(std::string&, std::string&)’ . I cannot figure out the problem.
stringheader.