#include <iostream>using namespace std;#include <iomanip>int main(){ //16进制的输入输出 cin>>hex>>j; //输入为十六进制数 // cout<<”hex:”<<”i=”<<hex<<i<<endl; //cout输出变量的“大写”十六进制格式 setiosflags(ios::uppercase) long long a,b; long long sum; while(cin >> hex & Read More
posted @ 2012-04-30 18:05 潘小雨 Views(269) Comments(0) Diggs(0) Edit
#include <iostream>using namespace std;#include <stack>int main(){ char map[]="ABCDEF"; int num,R,sign; stack<int>s; while(cin >> num >> R) { sign=0; if(num<0) { sign=1; num=-num; } while(num) { s.push(num%R); ... Read More
posted @ 2012-04-29 23:06 潘小雨 Views(267) Comments(0) Diggs(0) Edit
文件 BookInfo.txt关键字 书号 algorithms 034analysis 034,050,067computer 005,034data 005,010,023design 034fundamental 023introduction 010,... Read More
posted @ 2012-04-29 21:05 潘小雨 Views(207) Comments(0) Diggs(0) Edit
#include <iostream>using namespace std;#include <list> //stl list是一双向链表,可高效地进行插入删除元素#include <string>int main () { list<string> cc; list<string>::iterator pointCC; //iterator迭代器 cc.push_back("Chocolate"); cc.push_back("Strawberry"); cc.push_front(&qu Read More
posted @ 2012-04-29 20:23 潘小雨 Views(4989) Comments(0) Diggs(0) Edit
#include <iostream>using namespace std;#include <stdio.h>int main(){ // << 位元左移 // 1<<n = 2的n次方 // m<<n = m*2^n //getchar读取一个字符 //gets() 读取一行 遇到回车结束 int num,count,i; char a[1000]; cin >> num; getchar(); while(num--) { count=0; gets(a); for... Read More
posted @ 2012-03-29 22:43 潘小雨 Views(217) Comments(0) Diggs(1) Edit
1 保留小数点后两位#include <iomanip>cout << setiosflags(ios::fixed) << setprecision(2)<< getAdd(num) << endl;2 截取字符串 类似spilt#include <string>const char * spilt="/";char *p;p=strtok(str,spilt);while(p!=NULL){ //cout << p << endl; num[i++]=atoi(p); p=s Read More
posted @ 2012-03-17 20:51 潘小雨 Views(2676) Comments(0) Diggs(0) Edit
http://www.cnblogs.com/zhangzheny/archive/2007/06/16/785734.html Read More
posted @ 2012-03-12 17:14 潘小雨 Views(207) Comments(0) Diggs(1) Edit
vector是一种顺序容器,事实上和数组差不多,但它比数组更优越。一般来说数组不能动态拓展,因此在程序运行的时候不是浪费内存,就是造成越界。而vector正好弥补了这个缺陷,它的特征是相当于可分配拓展的数组,它的随机访问快,在中间插入和删除慢,但在末端插入和删除快,而且如果你用.at()访问的话,也可以做越界检查。http://hi.baidu.com/jojopeng2008/blog/item/51f33220b59835459822ed86.html#0http://blog.sina.com.cn/s/blog_77d646990100r67k.html例子:问题:括号配对问题http Read More
posted @ 2012-03-10 13:16 潘小雨 Views(37525) Comments(1) Diggs(4) Edit