map与结构体结合使用
来源:互联网 发布:机器人编程入门教程 编辑:程序博客网 时间:2024/05/17 04:19
在编写map中添加结构体的时候,尝试了好多种的方法,网上的这种方法给我提供了一个新奇的思路,在此记录下。
#include <iostream>#include <map> using namespace std; typedef struct alertInfo { double alertUp; double alertDown; alertInfo(double up, double down) { alertUp = up; alertDown = down; };} alert; int main(){ map<int, alert> alert_map; for (int i = 0; i < 10; i++) { alert_map.insert(pair<int, alert>(i, alert(240 * i, 200))); } for (auto it = alert_map.begin(); it != alert_map.end(); ++it) { cout << it->first << " - > " << it->second.alertUp << endl; }}
0 0
- map与结构体结合使用
- typedef与结构结合使用
- fastjson与Map、List结合使用
- (10.14)typedef与结构结合使用问题
- C/C++结构体struct 与结构体数组和枚举型enum的结合使用
- jquery与google map api结合使用 控件,监听器
- hdu 2112 HDU Today(map与dijkstra的结合使用)
- Python中map与lambda的结合使用
- 读写文件与结构体数组结合
- 结构体指针与结构体数组的结合。。。
- map 和grep结合使用
- map的键使用自定义结构体
- 如何在MAP中使用结构体
- vector与结构体结合的简单应用
- 【结构体与sort排序的完美结合】
- C语言结构体结合malloc、free使用小例子
- Map、数组以及dataTable的结合使用
- JSONObject、JSONArray结合Map的使用案例
- iOS_字典数组 按key分组和排序
- 【视频】雅思全程口语考试模拟评分(从3分至8分)
- java 键盘输入方法
- poj1753 枚举
- 快速排序算法及实现
- map与结构体结合使用
- group by 及 having 子句使用
- AJAX
- B. Friends and Presents
- 重定向 1>&2 2>&1
- 连续无空格英文字母或数字自动换行
- android初学------根据日期时间字符串返回date数据 获取年月日
- 织梦DedeCMS列表页、内页调用图集多张图片的方法
- <s:if>标签判断的使用