一阶段:c++学习代码保存
B站学习练习代码
1.3变量
#include
using namespace std;
int main1_3()
{
int a = 10;
cout << “a=” << a << endl;
system(“pause”);
return 0;
}
1.4常量
#include
using namespace std;
/*
#define定义宏常量 #define 常量名 常量值
const定义 的变量
*/
#define Day 7
int main1_4()
{
const int month = 12;
cout << “一周有:” << Day << “天”<<endl;
system(“pause”);
return 0;
}
这篇博客介绍了C++编程语言的基础知识,包括如何声明和使用变量以及常量。在1.3章节中,展示了如何定义整型变量`a`并输出其值。接着,在1.4章节里,讲解了宏常量`Day`和用`const`关键字定义的常量`month`的用法,强调了它们在程序中的不变性。
8803

被折叠的 条评论
为什么被折叠?



