摘要:
一、new创建 new运算符使用的一般格式为: new 类型 (初值) /new 类型 [大小] new动态创建二维数组的格式一般是这样: T (*p)[N] = new T [][N] 其中,T是某种类型,N是二维数组的列数。采用这种格式,列数必须指出,而行数无需指定。在这里,p的类型是TYPE* 阅读全文
摘要:
max() function is a library function of algorithm header, it is used to find the largest value from given two values, it accepts two values and return 阅读全文
摘要:
在很多情况下,我们不知道所要建立数组的大小,而是想根据需求动态的建立数组。但是通常使用 int arr[n] 这样的写法编译器会报错,因为n是变量。例如以下代码 int n = 10; int a[n]; 对于这种情况我们可以用以下的方法解决。 一、建立动态数组 用到的头文件:# include < 阅读全文
摘要:
BASIC-01 A+B问题 问题描述 输入A、B,输出A+B。 样例输入 12 45 样例输出 57 #include<iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << end 阅读全文