摘要: 1.I/O函数(1)scanf函数:int scanf(const char *format…..);从标准输入流stdin中按格式format将数据写到参数表中;若操作成功,返回写到参数表中的参数个数,否则返回EOF;注意以下几点:①scanf函数没有精度控制如出现:scanf(“%6.2f”,&a);是绝对错误的②在以%c格式输入字符数据时,所有输入的均为有效字符如:scanf(“%c%c%c”,&a,&b,&c);输入:d e f则a=’d’,b为空格字符' ',c=’d’如果以%s读入字符串,则空格键和回车键都可以作为输入结束的标志如:s 阅读全文
posted @ 2012-03-08 21:36 simple99 阅读(274) 评论(0) 推荐(0) 编辑
摘要: 一、int型变量在内存中存储详细情况[cpp] view plaincopyprint?//ByRichard #include<stdio.h> #include<math.h> intmain(){inti1=0;inti2=1;inti3=-1;inti4=127;inti5=-127;inti6=128;inti7=-128;inti8=255;inti9=-255;inti10=256;inti11=-256;inti12=(int)pow(2.0,16)-1;//65535 inti13=-(int)pow(2.0,16)+1;//-65535 inti14 阅读全文
posted @ 2012-03-08 20:03 simple99 阅读(4048) 评论(0) 推荐(3) 编辑
摘要: #include<stdexcept> template<typenameT,intMAXSIZE> classStack{ private: Telems[MAXSIZE];//elements intnumElems;//currentnumberofelements public: Stack();//constructor voidpush(Tconst&);//pushelement voidpop();//popelement Ttop()const;//returntopelement boolempty()const{//returnwhethe 阅读全文
posted @ 2012-03-08 18:51 simple99 阅读(108) 评论(0) 推荐(1) 编辑