Skip to content

Instantly share code, notes, and snippets.

@tanvir002700
Created April 16, 2016 16:14
Show Gist options
  • Save tanvir002700/a0341b750cd7ef07acca45af4c372b5c to your computer and use it in GitHub Desktop.
Save tanvir002700/a0341b750cd7ef07acca45af4c372b5c to your computer and use it in GitHub Desktop.
#include<iostream>
#include<map>
using namespace std;
int main()
{
map<char,int>Map;
for(char c='a';c<='j';c++)
{
int value=(int)c;
Map[c]=value;
}
for(char c='a';c<='z';c++)
{
if(Map[c]==0)cout<<"key "<<c<<" not found"<<endl;
else cout<<"key "<<c<<" found"<<endl;
}
return 0;
}
#include<iostream>
#include<map>
using namespace std;
int main()
{
map<char,int>Map;
for(char c='a';c<='j';c++)
{
int value=(int)c;
Map[c]=value;
}
for(char c='a';c<='z';c++)
{
if(Map.find(c)!=Map.end())cout<<"Key "<<c<<" found"<<endl;
else cout<<"Key "<<c<<" not found"<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment