上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 26 下一页
摘要: 1 #include <stdio.h> 2 #include <math.h> 3 4 int main(int argc, char* argv[]) 5 { 6 int m,i,k; 7 printf("please input the integer number:\n"); 8 scanf("%d",&m); 9 k=(int)sqrt(m);10 for (i=2;i<=k;i++)11 {12 if (m%i==0)13 {14 break;15 }16 ... 阅读全文
posted @ 2012-05-07 23:00 r3call 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 3 int main(int argc, char* argv[]) 4 { 5 int a; 6 scanf("%d",&a); 7 if (a<=0) 8 { 9 printf("不要乱输\n");10 return 0;11 }12 for (int i=1;;i++)13 {14 a=a/10;15 if (a==0)16 {17 break;18 }19 ... 阅读全文
posted @ 2012-05-07 22:45 r3call 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 3 bool IsLeapYear(int year) 4 { 5 if (year%4==0) 6 { 7 if (year%100==0) 8 { 9 if (year%400==0)10 {11 return true;12 }13 else14 {15 return false;16 ... 阅读全文
posted @ 2012-05-07 22:21 r3call 阅读(681) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include <math.h> 3 4 5 6 int main(int argc, char* argv[]) 7 { 8 double f; 9 double c=0;10 printf("请输入华氏温度\n");11 scanf("%lf",&f);12 c=(f*1.0-32.0)*5/9.0;13 printf("对应的摄氏温度为 %lf \n",c);14 return 0;15 }主要涉及的是浮点数之间的运算。 阅读全文
posted @ 2012-05-07 22:08 r3call 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 1 #include "stdafx.h" 2 #include <math.h> 3 4 5 //根据输入的三条边判断是不是正确的三角形 6 bool IsTri(double x,double y,double z) 7 { 8 if (! ( (x+y>z) && (abs(x-y)<z) ) ) 9 {10 return false;11 }12 if (! ( (x+z>y) && (abs(x-z)<y) ) )13 {14 return false;15 }16 if (! ( (z+y... 阅读全文
posted @ 2012-05-07 21:58 r3call 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 3 void main() 4 { 5 char c; 6 while((c=getchar())!='\n') 7 { 8 if( (c>='a'&&c<='z') || (c>='A'&&c<='Z') ) 9 {10 c=c+4;11 if( (c>'Z' && c<=('Z'+4) ) || (c>'z') )12 阅读全文
posted @ 2012-05-07 21:24 r3call 阅读(7470) 评论(0) 推荐(0) 编辑
摘要: 浮点数?浮点数是什么?浮点数就可以理解为小数。OK,那什么单精度,双精度又是什么意思呢?都是小数,就是后面能跟的尾巴不一样而已,看谁长。1 #include <stdio.h>2 3 void main()4 {5 float m=3.14;6 float n=3.141592653;7 printf("m=%f \n",m);8 printf("n=%f \n",n);9 }结果是:1 m=3.1400002 n=3.141593看来浮点数也是一样啊,装太多就装不下了。 1 mov [ebp+var_4], 4048F5C3h 2 mov 阅读全文
posted @ 2012-05-04 23:56 r3call 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 一个杯子,当装满水,而你继续往里面装的时候,水就会溢出来,同理,一个变量的存储容量是有限的,如果装过大,就会溢出。 1 #include <stdio.h> 2 3 void main() 4 { 5 short int a=32767; 6 short int b; 7 b=a+1; 8 9 printf("%d %d \n",a,b);10 }结果是:32767 -32768也就是说a最大就只能是32767了,如果再大,就变成其他数据了,这不是我们期望的。 1 mov [ebp+var_4], 32767 2 movsx eax, [e... 阅读全文
posted @ 2012-05-04 23:34 r3call 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 变量是一段有名字的连续存储空间。在源代码中通过定义变量来申请并命名这样的存储空间,并通过变量的名字来使用这段存储空间。 变量是程序中数据的临时存放场所。在代码中可以只使用一个变量,也可以使用多个变量,变量中可以存放单词、数值、日期以及属性。标识符:用来标识对象名字(包括变量、函数、数组、类型等)的有效字符序列。(1)关键字,如int、for、if等。(2)系统预定义标识符,如sin、main、printf等。(3)用户标识符,如变量名、函数名、数组名等。 1 #include <stdio.h> 2 3 void main() 4 { 5 //不同的整型 6 int a=10... 阅读全文
posted @ 2012-05-04 23:11 r3call 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 在程序运行过程中,其值不能被改变的量成为常量。下面是符号常量的例子:1 #include <stdio.h>2 #define PRICE 30 //符号常量3 void main()4 {5 int num,total;6 num = 10;7 total = num * PRICE;8 printf("total= %d\n",total);9 }同样的,我们汇编代码瞅瞅 1 00401010 >|> \55 push ebp 2 00401011 |. 8BEC mov ebp, esp 3 ... 阅读全文
posted @ 2012-05-03 22:31 r3call 阅读(205) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 26 下一页