请用文字或图片来描述以下代码
#include<bits/stdc++.h>//万能头文件
#include<stdlib.h>
using namespace std;
const int N = 10;//N种商品
typedef struct brand
{
int total;
char cname[100];
}BRAND;
map<int, BRAND> mapBrand;
int main()
{
//文件重定向 当前是读入从文件,输出在屏幕
freopen("p4.in","r",stdin);
//freopen("p4.out","w",stdout);
int id_temp;
BRAND b_temp;
//在内存中构建一个有三个属性的结构(品牌id,品牌名称,品牌当前销量)
for(int i = 0; i<N; i++)//模拟读取数据库中的数据
{
cin >> id_temp >> b_temp.total >> b_temp.cname;
mapBrand.insert(pair<int, BRAND>(id_temp, b_temp));
}
//给id是12598的品牌销量操作加1
map<int, BRAND>::iterator iter;
iter = mapBrand.find(12598);
if(iter != mapBrand.end())
{
cout<<"brand is "<<iter->second.cname;
iter->second.total++;
cout<<" total is "<<iter->second.total << endl;
}
else
cout<<"Do not Find"<<endl;
//给id是12598的品牌销量操作加1
iter = mapBrand.find(12598);
if(iter != mapBrand.end())
{
cout<<"brand is "<<iter->second.cname;
iter->second.total++;
cout<<" total is "<<iter->second.total << endl;
}
else
cout<<"Do not Find"<<endl;
//查看id 21771 品牌当前的销量
iter = mapBrand.find(21771);
if(iter != mapBrand.end())
{
cout<<"brand is "<<iter->second.cname;
cout<<" total is "<<iter->second.total << endl;
}
else
cout<<"Do not Find"<<endl;
//清空当前map
mapBrand.erase(mapBrand.begin(), mapBrand.end());
//注意这里没有把内存真正还给操作系统 ,linux下需要 malloc_trim函数才能彻底归还给操作系统
return 0;