Why wouldnt it break out of if() when i type "over" ?
Code:
// assignment operator with maps
#include <iostream>
#include <map>
using namespace std;
int main ()
{
string str;
int i;
map<string,int> first;
map<string,int>::iterator it;
for(;;)
{
if (str == "over")
{
break;
}
else
{
cout<<"Enter your name: ";
cin>>str;
cout<<"Enter your age: ";
cin>>i;
first[str]=i;
}
}
for ( it=first.begin() ; it != first.end(); it++ )
cout << it->first << " => " << it->second << endl;
system("pause");
return 0;
}