随笔分类 -  C/C++

C and C plus plus
摘要: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 阅读(7502) 评论(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 阅读(234) 评论(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 阅读(232) 评论(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 阅读(214) 评论(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 阅读(218) 评论(0) 推荐(0)
摘要:第四题:进行输出打印1 #include <stdio.h>2 3 void main()4 {5 printf("*****************************\n");6 printf("\tVery good!\t\t\n");7 printf("*****************************\n");8 }第五题:输入a,b,c三个值,输出其中最大者。 1 #include <stdio.h> 2 3 void main() 4 { 5 int max(int x,int y); 阅读全文
posted @ 2012-05-03 21:40 r3call 阅读(217) 评论(0) 推荐(0)
摘要:子函数,就像小弟一样,帮我做各种各样的事 1 #include <stdio.h> 2 3 void main() 4 { 5 int max(int x,int y); //函数的声明 6 int a,b,c; 7 scanf("%d,%d",&a,&b); //获取输入 8 c=max(a,b); //调用子函数 9 printf("max= %d \n",c);10 }11 12 int max(int x,int y)13 {14 int z;15 if(x>y)16 {17 z... 阅读全文
posted @ 2012-05-03 21:25 r3call 阅读(326) 评论(0) 推荐(0)
摘要:求两个整数之和,也是一个很小的程序,但是其中的道理,还是很多的,我们要好好体会。相加的两个数从哪来,到哪去? 1 #include <stdio.h> 2 3 void main() 4 { 5 int a,b,sum; 6 a=123; 7 b=456; 8 sum=a+b; 9 printf("sum is %d \n",sum);10 }工程下载地址:http://files.cnblogs.com/tk091/rl002.zip同样的,我们我OD来查看对应的汇编代码:00401010 > 55 push ebp004... 阅读全文
posted @ 2012-05-03 20:49 r3call 阅读(716) 评论(0) 推荐(0)
摘要:Hello world是最简单的c语言程序,也是大多数程序员的开始。1 #include <stdio.h>2 3 void main()4 {5 printf("Hello World ! \n");6 }对应的工程下载:http://files.cnblogs.com/tk091/rl001.7z我们用OD对其进行反汇编查看(查看的是主函数): 1 00401010 |> \55 push ebp 2 00401011 |. 8BEC mov ebp,esp 3 00401013 |. 83EC 40 sub esp,0... 阅读全文
posted @ 2012-05-03 20:17 r3call 阅读(202) 评论(0) 推荐(0)
摘要:1 // 5nt.cpp : Defines the entry point for the console application. 2 // 3 4 #include "stdafx.h" 5 #include "stdio.h" 6 #include "windows.h" 7 8 int main(int argc, char* argv[]) 9 {10 char szFileName[]="C:\\Program Files\\*.*";11 WIN32_FIND_DATA findDate;12 HA 阅读全文
posted @ 2012-05-02 17:30 r3call 阅读(432) 评论(0) 推荐(0)
摘要:from:http://blog.csdn.net/iiprogram/article/details/4792409PrefaceThis article was written to provide the better understanding to people who do not have any experience in this field. I am not going to describe about PE structure, so I think it was explained enough in Matt Pietrek's articles in M 阅读全文
posted @ 2012-04-25 13:24 r3call 阅读(555) 评论(0) 推荐(0)
摘要:from:http://blog.csdn.net/iiprogram/article/details/4792390自己写的PE信息查看工具(C代码),不甚完美,希望可以帮助初学PE的读者从编程的角度认识PE文件,GoodLuck!下面是源代码:/*///////////////////////////////////////////////////////////////////////////////ThisprogramwilloutputthevaluesofimportantmembersinthePEfileGoodLuck!/////////////////////////// 阅读全文
posted @ 2012-04-25 13:17 r3call 阅读(249) 评论(0) 推荐(0)
摘要:1 #include "stdafx.h" 2 #include "windows.h" 3 #include "wincon.h" 4 #include "stdlib.h" 5 #include "stdio.h" 6 #include "time.h" 7 #include "nb30.h" 8 #pragma comment(lib,"netapi32.lib") 9 10 typedef struct _ASTAT_11 {1 阅读全文
posted @ 2012-04-21 16:31 r3call 阅读(363) 评论(0) 推荐(0)
摘要:在程序中,.cpp扩展的文件并不是唯一一种常见的文件。另一种文件称为头文件,有时被称为include file。都文件基本都有一个.h扩展名。头文件的目的是将其它文件要用到的声明整合到一起。标准库头文件的使用看一下下面的程序: 1: #include <iostream> 2: int main() 3: { 4: using namespace std; 5: cout << "Hello, world!" << endl; 6: return 0; 7: }这个程序使用cout将Hello, world!输出到控制台的屏幕中。但是,你 阅读全文
posted @ 2012-04-18 13:10 r3call 阅读(365) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2012-04-15 16:52 r3call 阅读(1) 评论(0) 推荐(0)
该文被密码保护。
posted @ 2012-04-15 16:50 r3call 阅读(2) 评论(0) 推荐(0)
摘要:我们先来看一个很简单的程序,那就是大多数程序员的第一个程序,也是大名鼎鼎的程序:hellworld1 #include<stdio.h>2 3 void main()4 {5 printf("hello world!\n");6 }=================================================================在学习的开始,我们不需要知道每一句代码是什么意思,我们只需要在编译器上编写,然后能够运行通过即可。这就是学习的方法之一:抄袭。邓小平告诉我们,实践是检验真理的唯一标准,我们只有不断的写,才能知道程序做了什么 阅读全文
posted @ 2012-04-15 16:39 r3call 阅读(166) 评论(0) 推荐(0)
摘要:这里我们不会说C语言多么多么好,它的出现是因为什么?因为这些在百度和谷歌上已经很多了,你只要轻轻的点一下鼠标,就能找到。我们先来谈谈计算机的构成,那就是存储。存储:也许这个概念在我们看来有些难懂,如果换一个词,就会明白了,那就是容器(我们用来装东西)。 在生活中,我们无时无刻不在使用着,比如说塑料袋,水桶,杯子。。。。。。其实对计算机而言,很大程度上就是由存储器构成的,只是计算机存储的是0和1罢了(你想象一下,计算机里装了很多很多的0和1)。我们来看看计算机的三大部件:CPU、内存、硬盘。在CPU中,有寄存器,缓存。在内存更是一个存储器,硬盘更是。那么,都是存储器,它们有什么分别呢?那就是速度 阅读全文
posted @ 2012-04-15 16:30 r3call 阅读(176) 评论(0) 推荐(0)