#include #include using namespace std;int fun(int a){ std::cout * f){ auto fun = *f; fun(1); return 1;}int main(){ std::function fu...
分类:
其他好文 时间:
2014-09-20 02:14:46
阅读次数:
193
废话不多说,我们先看一下位置排序的算法:
#include
using namespace std;
int n = 0;
int m = 2;
int l = 0;
int a[100];
void solve(int l);
int main()
{
cout<<"请输入位数 n "<>n;
solve(l);
return 0;
}
...
分类:
编程语言 时间:
2014-09-19 15:46:05
阅读次数:
206
#include using namespace std; class myClass1 { public : myClass1():n(0){}; void setn(int tmpn){this->n=tmpn;} void show(){cout private: friend class myClass2;...
分类:
编程语言 时间:
2014-09-19 13:56:55
阅读次数:
204
1:cin , cout不是语句,而是iostream类的对象而已,这些都是属于控制平台流;流写入缓冲区,缓冲区刷新到设备上显示。 2:endl特殊字符,表示换行且刷新缓冲区 3:换行和空格一样,除了在头文件上以及字符串字面值。 4:对于结束字符是 换行+ctrl+z+换行 5:while和for区...
分类:
其他好文 时间:
2014-09-18 22:04:34
阅读次数:
139
对数组地址的理解,如 int c[2] = {2,3}; int(*cp)[2] = &c; cout << &c[0] << c << cp << endl;输出都是一样的。。结论:当对数组用&比如&c,那么意思就是“对数组取地址或者取得数组的地址”,而数组的地址返回的就是第一个元素的地址,加上数...
分类:
编程语言 时间:
2014-09-18 08:33:13
阅读次数:
258
运算符重载(Operator overloading)是C++重要特性之一,本文通过列举标准库中的运算符重载实例,展示运算符重载在C++里的妙用。具体包括重载operator<>支持cin,cout输入输出;重载operator[],实现下标运算;重载operator+=实现元素追加;重载operator()实现函数调用。...
分类:
编程语言 时间:
2014-09-18 00:48:53
阅读次数:
261
1、标准库string类型:用户程序要使用string类型对象,必须包含相关头文件#include字符串字面值与标准库string类型不是同一种类型,字符串字面值是字符数组,而string是对象2、intmain(){strings;cin>>s;cout>s) result+=s;cout=[]其...
分类:
编程语言 时间:
2014-09-17 02:15:51
阅读次数:
423
------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! -------循环结构while循环1.while循环基本使用int main(){ int cout = 0; while(countint main (){ int n =0; // 一定要初始化 whi.....
分类:
编程语言 时间:
2014-09-16 23:34:01
阅读次数:
290
1 #include 2 3 using namespace std; 4 void hello(int a ,int b=7,char* pszC="*") 5 { 6 cout<<"hello"; 7 } 8 9 int main()10 {11 // hello(5);12...
分类:
其他好文 时间:
2014-09-16 18:52:40
阅读次数:
177
#include using namespace std;int main () { int a = 3; int b = 5; cout<<"a="<<a<<",b="<<b<<endl; a = a+b; ///a=7 b = a-b; ///b=3; ...
分类:
其他好文 时间:
2014-09-16 18:45:40
阅读次数:
197