C++ 基础教程
课程大纲:
- 初识 + 数据类型 + 运算符
- 程序流程结构 + 数组 + 函数
- 指针 + 结构体 + 项目练习
一、初识
复习导问
每个词属于哪类?在代码中起什么作用?
#include <iostream>
using namespace std;
/* 多行注释写法 */
#define Day 7 // define 宏常量
const int Week = 4; // const 修饰的变量
int main() {
int _a = 6; // 变量
cout << "hello,world" << endl;
cout << "_a=" << _a << endl;
cout << Day << endl;
cout << Week << endl;
system("pause");
return 0;
}
1. 编写四部曲
创建项目 -> 创建文件 -> 编写代码 -> 运行程序
例:C++ 程序最基本框架
#include <iostream>
using namespace std;
int main() {
system("pause");
return 0;
}
2. 注释
单行注释
// 注释内容
























