2011年8月1日

ABCDE*4=EDCBA

摘要: 一个5位数字ABCDE*4=EDCBA ,这5个数字不重复,输出这样的数字#include<iostream>#include<stack>#include<algorithm>#include<cmath>using namespace std;int reverse(int i){int resualt=0;stack<int> mys;for(int j=4;j>=0;j--){mys.push((i/(int)pow(10,j)));i=i%((int)pow(10,j));}for( j=4;j>=0;j--){ 阅读全文

posted @ 2011-08-01 14:19 原来... 阅读(4930) 评论(1) 推荐(0) 编辑

C++符号优先级

摘要: PrecedenceOperatorDescriptionExampleAssociativity1()[]->.::++--Grouping operatorArray accessMember access from a pointerMember access from an objectScoping operatorPost-incrementPost-decrement(a + b) / 4;array[4] = 2;ptr->age = 34;obj.age = 34;Class::age = 2;for( i = 0; i < 10; i++ ) ...for 阅读全文

posted @ 2011-08-01 11:41 原来... 阅读(2203) 评论(0) 推荐(0) 编辑

STL list链表的用法详解

摘要: 本文以List容器为例子,介绍了STL的基本内容,从容器到迭代器,再到普通函数,而且例子丰富,通俗易懂。不失为STL的入门文章,新手不容错过! 0 前言 1 定义一个list 2 使用list的成员函数push_back和push_front插入一个元素到list中 3 list的成员函数empty() 4 用for循环来处理list中的元素 5 用STL的通用算法for_each来处理list中的元素 6 用STL的通用算法count_if()来统计list中的元素个数 7 使用count_if()的一个更加复杂的函数对象。 8 使用STL通用算法find()在list中查找对象 9 使用S 阅读全文

posted @ 2011-08-01 08:38 原来... 阅读(28840) 评论(3) 推荐(4) 编辑

导航