2011年7月31日

得到下一秒的日期和时间并计算是第几天

摘要: 推荐方法一,方法二本人所写,给方法一比较简直就是刚学C 而且C也没学好,不会C++,面向对象的思想真不是一撮而就的事啊!我需要更加努力!加油。。。。。。。方法一:#include<iostream.h>#include<stdio.h>class date{private:int m_nYear, m_nMonth, m_nDay, m_nHour, m_nMin, m_nSec;int GetDay(int month);bool IsLeapYear();public:date(int,int,int,int,int,int);const date GetNextD 阅读全文

posted @ 2011-07-31 19:32 原来... 阅读(399) 评论(0) 推荐(0) 编辑

优先队列(priority_queue)的C语言实现(转)

摘要: 优先队列(priority_queue)的C语言实现 优先队列(priority_queue)和一般队列(queue)的函数接口一致,不同的是,优先队列每次出列的是整个队列中最小(或者最大)的元素。 本文简要介绍一种基于数组二叉堆实现的优先队列,定义的数据结构和实现的函数接口说明如下:一、键值对结构体:KeyValue// =============KeyValue Struct==================================typedef struct key_value_struct KeyValue;struct key_value_struct{int _key;v 阅读全文

posted @ 2011-07-31 11:49 原来... 阅读(11444) 评论(0) 推荐(0) 编辑

STL map 按值排序

摘要: //在STL中,map是按键来排序的,但很多时候需要按值来排序。一种方法是将map转化为vector,然后排序。#include<iostream>#include<vector>#include<map>#include<string>#include<algorithm>usingnamespacestd;voidsortMapByValue(map<string,int>&tMap,vector<pair<string,int>>&tVector);intcmp(constpa 阅读全文

posted @ 2011-07-31 09:28 原来... 阅读(4636) 评论(0) 推荐(0) 编辑

导航