需要准备的材料分别有:电脑、C语言编译器。
1、首先,打开C语言编译器,新建一个初始.cpp文件,例如:test.cpp。
2、在test.cpp文件中,输入C语言代码:__int64 aa = pow(2, 32)printf("%I64d", a)。
3、编译器运行test.cpp文件,此时成功定义了64位整数并进行了输出。
getimage() 保存图像函数功能: 函数getimage()保存左上角与右下角所定义的屏幕上像素图形到指定的内存区域。
用法: 该函数调用方式为void getimage(int left,int top,int right,int bottom,void *buf)
说明: 函数中参数(left,top)为要保存的图像屏幕的左上角,(right,bottom)为其右下角,buf指向保存图像的内存地址。调用getimage()保存屏幕图像,可用imagesize()函数确定保存图像所需字节数,再用malloc()函数分配存储图像的内存(内存分配必须小于64KB),还可以用下面函数putimage()输出getimage()保存的屏幕图像。
这个函数对应的头文件为graphics.h
返回值: 无
例: 把带有两对角线的矩形拷贝到屏幕其它位置上:
#include<garphics.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int driver,mode
unsigned size
void *buf
driver=DETECT
mode=0
initgraph(&driver,&mode,"")
sector(15)
rectangle(20,20,200,200)
setcolor(RED)
line(20,20,200,200)
setcolor(GREEN)
line(20,200,200,20)
getch()
size=imagesize(20,20,200,200)
if(size!=-1){
buf=malloc(size)
if(buf){
getimage(20,20,200,200,buf)
putimage(100,100,buf,COPy_PUT)
putimage(300,50,buf,COPy_PUT)
}
}
outtext("press a key")
getch()
restorecrtmode()