ctrl+k+u-------------------一键解除注释
ctrl+k+c-------------------一键注释/ctrl+shift+/(?下面的斜杠)
随机数
srand((unsigned int)time(NULL));
int num=rand() % 100;
cout << "随机数为:" << num << endl;
new的基本语法
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
//new的基本语法(在堆区中创建变量,会返回所给类型的指针)
int*p=new int(10);//代表在堆区创建了一个数据类型为int,值为10的一个空间
delete p;
int* arr = new int[10];//代表在堆区中创建了int型的数组,元素个数为10
delete[]arr;//删除数组时delete后需要加上[]
system("pause");
return 0;
}