码迷,mamicode.com
首页 >  
搜索关键字:提升cin cout    ( 7220个结果
|与||的区别
在众多编程语言中,|与||代表了不同的运算。其中|是按位或运算,||是逻辑或运算。从字面意思来理解,|常可以用于具体数值的计算,结果为数值,而||是用来逻辑运算的没结果只有False或者True。例如inta=2; intb=3; intc=a|b; intd=a||b; cout<<c<<endl; cout<<..
分类:其他好文   时间:2014-11-18 01:47:26    阅读次数:177
C++中用指向二维数组的指针作函数参数
举例说明:函数声明:void Fun(int (*p)[4] ); void Fun(int (*p)[4] ) { int i=0,j=0; for(i=0;i<4;i++) for(j=0;j<4;j++) cout << *(*(p+i)+j) << en...
分类:编程语言   时间:2014-11-18 01:35:44    阅读次数:169
hello world
1 std::cout<<"hello world"<<std::endl;View Code
分类:其他好文   时间:2014-11-18 00:16:04    阅读次数:145
C++ bool和string转换
直接贴代码吧,用g++可以编译,测试ok #include #include using namespace std; int main(int argc, char **argv) { bool a = true; ostringstream os1; os1 << a; cout << string(os1.str()) << endl; ...
分类:编程语言   时间:2014-11-17 21:18:56    阅读次数:317
C++中的空类与空结构体大小
今天面试遇到了一个很有意思的问题,即空结构体在C++中所占的内存大小是多少?参见如下代码:#include struct S0{ };int main(){ std::cout << sizeof S0 << std::endl; return 0;} 面试官当场提醒了我一下,说如...
分类:编程语言   时间:2014-11-17 20:55:56    阅读次数:203
分离正整数中的各位数
#include using namespace std; int main() { int a,b; while (cin>>a) { do { b=a%10; a=a/10; cout<<b<<" "; }...
分类:其他好文   时间:2014-11-17 12:29:47    阅读次数:129
输入一正整数,其对应的二进制形式为
#include using namespace std; void FX(int ); int main() { int n; cout<>n; cout<<n<<":"; FX(n); return 0; } void FX(int n) { int a=n; if (a==1) ...
分类:其他好文   时间:2014-11-17 12:25:04    阅读次数:127
【算法设计与分析】1、整数划分问题
#include using namespace std; /* void show(int *put, int len) //一个输出函数 { for(int i=0 ; i < len ; ++i) cout<<put[i]<<" + "; cout<<endl; } */ int huafen(int x, int m) //实现整数x的划分,一个参数是要划分的数,这里有一...
分类:编程语言   时间:2014-11-16 18:42:24    阅读次数:196
hdu 5104 Primes Problem(prime 将三重循环化两重)
//宁用大量的二维不用量小的三维#include #include#includeusing namespace std;int prime[1000],num[10005];int Cout;void initPrime(){ for(int i=2;i>n) { cn=...
分类:其他好文   时间:2014-11-16 00:30:12    阅读次数:191
软件快速计算平方根与平方根的倒数
#include #include using namespace std; float Sqrt(float x); float InvSqrt(float x); int main(void) {            system("color F0");      cout.setf(ios::fixed);                      ...
分类:其他好文   时间:2014-11-15 18:55:14    阅读次数:143
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!