结果是96 a=12;a<<2;/*a左移运算 相当于乘法 左移一位为乘2,两位就乘4 */ (a<<2)<<1;/* 再左移一位 再乘2 c=a*2*2*2=12*8=96 */
include <stdio.h>void main( ){ char s[20], ch; int i,j; printf("Please input a string:\n"); gets(s);//输入字符串 printf("Please input acharacter:\n"); ch=getchar();//输入一个字符。 for(i=0;i<20;i++)//对于每个位置做遍历。 { fo...
关键还在于用scanf函数输入字符串的规则,假如你不用scanf函数,而用gets函数,那么就能得到你想要的答案,因为gets函数是不能空格为结尾标志,而以'\n',也就是回车键为标志。如下:include<stdio.h> main(){ char str1[]="hao do you do",str2[15]; /*注意,是str2[15],不是10,因为...
include <stdio.h> include <stdlib.h> include <STRING> void main(){ float weight,volume;int size, letters;char name[40];printf("HI!What's your first name?");scanf("%s",name);printf("$s,what's your weight in punds?",name);scanf("%f", &weight);size=sizeof(name);le...
if(x++ > 5) 在这里 x已经被++了一次了,所以输出一定是加一的结果。还有 在比较的时候 这样的比较是用x ++之前的值比较的 也就是你输入什么 就用什么和5比 还有后面的两个printf 打印有什么区别?如果说有区别的话 是6 输出7 的时候没有换行……3输4的时候 换了一行……...
int a[3][2]={(0,1),(2,3),(4,5)};int a[3][2]={{0,1},{2,3},{4,5}};两种方式赋值不同,第一种数组的值分别为1,3,5,0,0,0,第二种是0,1,2,3,4,5
0x48是16进制的整数,数字大小为:4*16+8=72,printf 中%d表示是按十进制输出,所以输出为72
include <stdio.h> int main(){ int a[10];int i,j,t;printf("input 10 numbers:\n");for(i=0;i<10;i++)scanf("%d\n",&a[i]);printf("\n");for(j=0;j<9;j++)for(i=0;i<9-j;i++)if(a[i]>a[i+1]){ t=a[i];a[i]=a[i+1];a[i+1]=t;} printf("...