标签:运算 lex bsp for blog 地址 pre scanf int
当式1正确时,取式2的值;否则,取式3的值
1 #include<stdio.h> 2 #include<stdlib.h> 3 4 void main(){ 5 int num; 6 scanf("%d",&num); 7 printf("\n%d",num); 8 printf("\n%ld",num); 9 printf("\n%10d",num);//10位靠右 10 printf("\n%-10d",num);//10位靠左 11 printf("\n%010d",num);//10位,左边补0 12 printf("\n%5d",num);//5位,超过按照实际,不超过则靠右 13 14 system("pause"); 15 }
1 #include<stdio.h> 2 #include<stdlib.h> 3 4 void main(){ 5 int num; 6 char str0[30],str[50]; 7 scanf("%d%s",&num,str0); 8 printf("num=%d,str0=%s",num,str0); 9 sprintf(str,"for /l %%i in (1,1,%d) do %s",num,str0); 10 system(str); 11 12 system("pause"); 13 }
打开3个计算器
1 #include<stdio.h> 2 #include<windows.h> 3 4 void main(){ 5 int x=10; 6 int y=100000; 7 printf("%x,%x",&x,&y); 8 while(1){ 9 printf("\n阿飞有%d个妞,有%d元",x,y); 10 Sleep(1000); 11 } 12 }
根据地址,编写代码,生成dll文件,进行注射
1 _declspec(dllexport) void go(){ 2 int *p=(int *)0x4dfcbc; 3 int *q; 4 *p=0; 5 q=(int *)0x4dfcb0; 6 *q=100; 7 }
1 #include<stdio.h> 2 #include<stdlib.h> 3 4 void main(){ 5 char str[50],strurl[50]; 6 scanf("%s",str); 7 sprintf(strurl,"%s",str);//实现字符串的赋值,因为字符串不能通过 str=strurl 赋值 8 sprintf(strurl,"%.7s",str);//截取前面7个字符 9 sprintf(strurl,"%10.7s",str);//10位宽,截取前面7个字符 10 system(strurl); 11 system("pause"); 12 }
[c/c++] programming之路(9)、运算优先级
标签:运算 lex bsp for blog 地址 pre scanf int
原文地址:http://www.cnblogs.com/little-monkey/p/7224760.html