在ISO/ANSI C++中,常量的定义方式是在变量之前添加const修饰符
#include<iostream>
using namespace std;
const int A = 5;
int main(){
const int B = 6;
cout << A << "\t" << B;
system("pause");
return 0;
}
const 可以写在任何地方~
在ISO/ANSI C++中,常量的定义方式是在变量之前添加const修饰符
#include<iostream>
using namespace std;
const int A = 5;
int main(){
const int B = 6;
cout << A << "\t" << B;
system("pause");
return 0;
}