一、查看运行时间
头文件 #include<ctime>
#include <ctime>
#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int t=clock();
printf("%d\n",a-b);
printf("Time:");
cout << clock()-t << endl;
return 0;
}
二、查看空间大小
1、设置环境变量
我的电脑——属性——高级系统设置——环境变量——Path——新建(目录为g++目录)
2、如a.cpp,
执行
g++ a.cpp -o a.exe size a.exe
三、程序运行分析
g++ a.cpp -o a.exe -Wall -pg a.exe gprof a.exe > t.out
文章评论