cout是右结合的cout<<++a<<","<<a++;的运行顺序是1.a的值压栈2.a自加3.‘,’压栈4.a自加5.a的值压栈6.输出栈中元素int a[] = {1,3,5,7,9};int * p = a;cout<<a<<endl;cout<<p<<" "<<*p<<endl; ...
分类:
其他好文 时间:
2014-08-13 14:32:06
阅读次数:
181
algorithm 简单用法#include #include #include using namespace std;int student_Score[] = { 50,80,93,23,66};void pritit(int nScore){ cout= 60;}int main(int a...
分类:
其他好文 时间:
2014-08-13 14:22:36
阅读次数:
157
1.一般用C语言节约空间,要用C++库函数或STL时才用C++;cout、cin和printf、scanf最好不要混用。大数据输入输出时最好不要用cin、cout,防止超时。2.有时候int型不够用,可以用long long或__int64型(两个下划线__)。值类型表示值介于 -2^63 ( -9...
分类:
其他好文 时间:
2014-08-13 12:54:16
阅读次数:
186
/**
* 功能:吧变量和表达式转换成字符串
* 时间:2014年8月13日08:57:32
* 作者:cutter_point
*/
#include
#include
using namespace std;
//定义一个宏,使用便捷输出,用#来吧变量字符串化
#define P(A) cout<<#A<<" : "<<A<<endl;
int main()
{
int a=1...
分类:
编程语言 时间:
2014-08-13 10:38:45
阅读次数:
193
/**
* 功能:命令行参数
* 时间:2014年8月13日08:56:24
* 作者:cutter_point
*/
#include
#include
using namespace std;
int main(int argc, char* argv[]) //字符指针
{
cout<<"argc="<<argc<<endl;
for(int i=0 ; i !...
分类:
编程语言 时间:
2014-08-13 10:38:35
阅读次数:
245
/**
* 功能:宏处理定义
* 时间:2014年8月1日09:07:33
* 作者:cutter_point
*/
#include
#include
using namespace std;
#define PRINT(STR, VAR) cout<<STR "=" <<VAR<<endl; //这里宏定义之后,所有PRINT("STR", VAR)
//都会被cout之后的东西所覆盖...
分类:
编程语言 时间:
2014-08-12 22:15:24
阅读次数:
208
从今天开始在博客里写C++primer的文字。主要以后面的习题作业为主,会有必要的知识点补充。本人也是菜鸟,可能有不对之处,还望指出。前期内容可能会比较水。1.1略1.2略1.3cin和cout分别是istream和ostream的对象。#includeusing namespace std;int...
分类:
编程语言 时间:
2014-08-12 21:50:14
阅读次数:
365
#include
#include
#include
using namespace std;
void ComStr(char *str, string &s,int m)
{
if (m == 0)
{
cout<<s<<endl;
return ;
}
if (*str != '\0')
{
s.push_back(*str);
ComStr(str+1,s ...
分类:
其他好文 时间:
2014-08-12 17:14:34
阅读次数:
223
//输入一个数据后用“/”和“%”分离#includeusing namespace std;int main(){ int temp1,temp2; double n; begin: cout>n; if(n<1000000) { cout<<"w...
分类:
其他好文 时间:
2014-08-12 16:34:04
阅读次数:
182
/*
* 算法导论 第八章 线性时间排序
* 计数排序、基数排序和桶排序
*/
#include
#include
#include
#include
using namespace std;
void printArray(int arr[], int len, char *str)
{
cout << str << endl;
for (int i=0; i<len; i...
分类:
其他好文 时间:
2014-08-12 00:46:13
阅读次数:
210