|
#include <iostream.h>
#include <conio.h>
#include <bios.h>
#include <time.h>
void auto_var();
void register_var();
main()
{
auto_var();
register_var();
getch();
}
void auto_var()
{
long t1, t2;
int x=0, y=0;
long z=0;
cout <<"초 기 값 z="<<z<<endl;
t1=biostime(0,0L);
for(x=0;x<30000;x++)
for(y=0;y<30000;y++) z++;
cout <<"9억번 연산후 z: "<<z<<endl;
t2=biostime(0,0L);
cout<<"자동변수 사용시간="<<(t1-t2)/18.2<<endl;
}
void register_var()
{
long t1, t2;
register int x=0, y=0;
long z=0;
cout <<"초 기 값 z="<<z<<endl;
t1=biostime(0,0L);
for(x=0;x<30000;x++)
for(y=0;y<30000;y++) z++;
cout <<"9억번 연산후 z: "<<z<<endl;
t2=biostime(0,0L);
cout<<"자동변수 사용시간="<<(t1-t2)/18.2<<endl;
}
|