码迷,mamicode.com
首页 >  
搜索关键字:printf bc    ( 16964个结果
关于在vs2010下,snprintf的使用须知
#include<stdio.h> #include<stdlib.h> void f(const char *p) { ?char buf[4]={}; ??? _snprintf(buf, sizeof(buf), "%6s", p); ?printf("%c",buf); ??? printf("%2s",buf); } int main() { ?char s[4]...
分类:其他好文   时间:2014-07-22 09:06:03    阅读次数:240
函数参数传递方式详解
1. 函数参数传递方式之一:值传递   (1)值传递的一个错误认识 先看如下的一个问题: void Exchg1(int x, int y) /* 定义中的x,y变量被称为Exchg1函数的形式参数 */ {   int tmp;   tmp = x;    x= y;    y= tmp;   printf("x = %d, y = %d.\n", x, y); } 问:...
分类:其他好文   时间:2014-07-21 11:24:44    阅读次数:264
输入/输出一维数组的各元素
方法一:数组法——用a[i]形式法访问数组元素 #include int main() {     int i,a[10],*ptr=a;     for(i=0;i         scanf("%d",&a[i]);     for(i=0;i     printf("%4d",a[i]);     printf("\n"); } 方法二:指针法——用*(ptr+i)形式...
分类:其他好文   时间:2014-07-21 11:14:14    阅读次数:171
从键盘上输入两个数,按小大的顺序输出
#include #include int main() {    int num1,num2;    int *num1_p=&num1,*num2_p=&num2,*pointer;    printf("Input the first number:");    scanf("%d",num1_p);    printf("Input the second num...
分类:其他好文   时间:2014-07-21 11:14:14    阅读次数:180
C语言结构体
直接上代码 struct People{ int age; } int main(){ struct People * p= malloc(sizeof(struct Perople)); p->age=10; struct People * p1=p; p-age=12; printf("%d\n",p1->age); free(p); return 0; } } 函...
分类:编程语言   时间:2014-07-21 10:22:57    阅读次数:222
C中的指针的指针
指针存储的是内存地址,那么当代码执行 int?*iptr; int?a; iptr?=?&a; ????它表示iptr指向了a所在的内存地址。那么若执行 *iptr?=?10; printf("a?=?%d\n",a); ????那么a的值为多少呢? ...
分类:其他好文   时间:2014-07-21 10:11:50    阅读次数:166
poj1961 kmp
题目大意,求这个字符串到i为止有多少个循环串;int k = i-next[i]; if((i+1)%k == 0 && (i+1)!= k) printf("%d %d\n", i+1, (i+1)/k);这是代码的主要部分,求next数组的部分...
分类:其他好文   时间:2014-07-21 09:34:02    阅读次数:213
poj 2288 Islands and Bridges
题意: 给你一个双向连通图,求 获得权值最大 的 哈密顿通路的 权值 和 这个权值对应的数目; 其中权值计算方法是 列如 ABCD 权值是a+b+c+d+ab+bc+cd 如果 A,B,C 和B,C,D 可构成三角形分别加上abc,bcd;这个题 和poj 3311 很相像: 那个需要记录一个最后....
分类:其他好文   时间:2014-07-21 09:32:05    阅读次数:263
c语言 给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。
6,给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。 //intnum=0,temp=0,i=0; //printf("输入一位数字:"); //scanf("%d",&num); //while(num>0){ //temp=num%10; //printf("%d",temp); //i++; //num=num/10; //} //printf("\n%d位数",i);
分类:编程语言   时间:2014-07-21 07:21:35    阅读次数:252
c语言函数实现交换两个数的值
代码: 1 #include 2 3 void swap(int x,int y) 4 { 5 int temp; 6 7 temp = x; 8 x = y; 9 y = temp;10 printf("In swap: x = %d,y = ...
分类:编程语言   时间:2014-07-20 22:14:56    阅读次数:255
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!