码迷,mamicode.com
首页 >  
搜索关键字:printf bc    ( 16964个结果
C 语言 const 关键字
#include int main(void){int i = 1;int j = 100;const int * temp = &i;printf("%d\n",*temp);i = 2;printf("%d\n",*temp);temp = &j;printf("%d\n",*temp);ret...
分类:其他好文   时间:2014-05-26 23:11:42    阅读次数:330
CPP-STL:用vector保存对象时保存指针的优点, 以及reserve的使用(转)
代码1[cpp]view plaincopy#include#includeclassA{public:A(){printf("A()/n");}~A(){printf("~A()/n");}A(constA&other){printf("other/n");}};intmain(){Aa;Ab(....
分类:其他好文   时间:2014-05-26 22:18:50    阅读次数:382
十进制转十六进制
scanf("%d", &n);printf("%X\n", n);十六进制转十进制注意8位这个提示,好好看看范围unsigned int n;scanf("%X", &n);printf("%u\n", n);
分类:其他好文   时间:2014-05-26 15:47:13    阅读次数:183
内存分区
1 #include 2 #include 3 4 int k=1; 5 int main() 6 { 7 int i=1; 8 char *j; 9 static int m=1;10 char *n="hello";11 12 printf("栈区地址...
分类:其他好文   时间:2014-05-26 14:24:28    阅读次数:201
C++ Input Output
C++的IO比较复杂,记录一下碰到的问题:#include "stdafx.h"#include using namespace std;int main(int argc, char* argv[]){ cout << 22/5*3 << endl; printf("Hello Wor...
分类:编程语言   时间:2014-05-26 12:42:11    阅读次数:290
C语言的经典排序算法源码
1、插入排序:插入法是一种比较直观的排序方法。它首先把数组头两个元素排好序,再依次把后面的元素插入适当的位置。把数组元素插完也就完成了排序。代码如下:#includevoid main(){int a[10];int i,j,k;printf("请输入10个数字!空格隔开\n");for(i=0;i...
分类:编程语言   时间:2014-05-26 11:45:36    阅读次数:344
C语言将10进制转为2进制
第一种方法: #include void dectobin(int n); int main() { int x=0; scanf("%d",&x);//只能正数 dectobin(x); printf("\n"); return 0; } void dectobin(int n) { if(n/2>0) { dectobin(n...
分类:编程语言   时间:2014-05-26 04:43:00    阅读次数:322
sprintf
选自《CSDN 社区电子杂志——C/C++杂志》http://emag.csdn.net2005 年1 月 总第1 期 - 93 -本文作者:steedhorse(晨星)printf 可能是许多程序员在开始学习C 语言时接触到的第二个函数(我猜第一个是main),说起来,自然是老朋友了,可是,你对这...
分类:其他好文   时间:2014-05-23 04:51:17    阅读次数:369
这个不需要考虑空间的大小么?
#include#includevoid main(){ char a[3]; char*str = "adgc"; strcpy(a,str); printf("%s ",a);}程序运行的结果为什么是 adgc 呢? a的空间只有3个字符呢 ,为什么可以存放str呢?望求解。
分类:其他好文   时间:2014-05-22 14:02:13    阅读次数:265
【剑指offer】字符串的组合
剑指offer上的拓展题目,输入一个字符串,输出该字符串的字符的所有组合,比如输入字符串:abc,输出a、b、c、ab、ac、bc、abc。 思路:与上一题类似,也可以用递归求解。可以考虑求长度为n的字符串中m个字符的组合,设为C(n,m)。原问题的解即为C(n, 1), C(n, 2),...C(n, n)的总和。对于求C(n, m),从第一个字符开始扫描,每个字符有两种情况,要么被选中,要么不被选中,如果被选中,递归求解C(n-1, m-1)。如果未被选中,递归求解C(n-1, m)。不管哪种方...
分类:其他好文   时间:2014-05-21 14:02:03    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!