第二章 防御性编程
猜字游戏
/**
* 书本:【ThinkingInC++】
* 功能:实现一个猜谜的游戏
* 时间:2014年10月8日21:54:44
* 作者:cutter_point
*/
#include
#include
#include
using namespace std;
int main()
{
cout<<"自己想出来一个数字,在1到100之间的,...
分类:
编程语言 时间:
2014-10-09 16:43:38
阅读次数:
227
#includeusing namespace std;int main(){ long long sum1,sum2,sum3,sum4; long int a,b; cin>>a>>b; sum1=a+b; sum2=a-b; sum3=a*b; sum4=a/b; cout<<sum1<<en...
分类:
其他好文 时间:
2014-10-09 15:03:03
阅读次数:
185
#include #include int main() { unsigned int x; std::stringstream ss; ss > x; // output it as a signed type std::cout (x) << std::end...
分类:
其他好文 时间:
2014-10-09 14:17:23
阅读次数:
201
#define LOCAL#include#includeusing namespace std;typedef int ElemType;void fun1(ElemType *x){ cout>a; cout<<(*&a)<<endl; fun1(&a); ...
分类:
编程语言 时间:
2014-10-08 14:42:55
阅读次数:
221
#include#include#include using namespace std;int main(){ cout ::max)(); cout ::min)() ::max)(); cout ::min)() ::max)(); cout ::min)() ::ma...
分类:
编程语言 时间:
2014-10-07 17:12:23
阅读次数:
180
分析:这道题是刘汝佳灰书上所给的一道题。题目很简单,就是处理字符串并排序输出。但我却卡了很久,试了很多不同的方式,至今使用字符串的一个还没有调试出来。POJ 1002是一道几乎相同的题(不过没有多组数据)。注意事项:1. 数据量很大,最好不用cin/cout(当然也可以取消std::同步)。2. 每...
分类:
其他好文 时间:
2014-10-06 01:44:39
阅读次数:
286
一、引用 简单的来说,引用就是变量的别名(alias), 通过别名我们可以操作引用代表的变量。 定义一个引用的语法如下所示: 变量类型 &引用标识符 = 变量名。Exp: int iVar=10; int &iRef = iVar; iRef = 20 ; cout 2 #in...
分类:
其他好文 时间:
2014-10-05 23:36:39
阅读次数:
297
http://acm.hdu.edu.cn/showproblem.php?pid=5007
纯属联系String的substr
当substr截取的长度小于写的话
string te;
int n;
te="Hellow";
cout
我试了下 打印出来的是low....
写的时候没去限制边界还是AC了
//#pragma comment(linker, "...
分类:
其他好文 时间:
2014-10-04 20:19:27
阅读次数:
170
本教程是一个复习的课程,也是对新手提供最简单的C++语法学起,高手不要笑我~~~#includeusing namespace std;int main(){ cout这句话是什么意思?include就是包含而“#”代表了预处理命令,简单的说就是要包含后面的里内容iostream就是输入输出的头文....
分类:
其他好文 时间:
2014-10-04 20:16:57
阅读次数:
190
static#include#include#includeusing namespace std;static int a=100;void func(){ static int a=10; a++; cout#include#includeusing namespace std...
分类:
编程语言 时间:
2014-10-04 18:09:56
阅读次数:
230