C++ Primer Plus

第一章 初始C++

cpp 复制代码
#include <iostream> //#:预处理

int main(void) //void:无参数
{
	using namespace std;

	int carrots; //定义声明语句:开辟内存空间, int:整型 

	cout << "how many corrots do you have?" << endl; //cout:输出流(out) endl:回车换行符
	cin >> carrots;
	cout << "here are two more.";
	carrots = carrots + 2;
	cout << "now you have " << carrots << " carrots" << endl;

	return 0; //标识符:程序成功运行
}

第二章 函数

2.1 使用有返回值的函数

cpp 复制代码
#include <iostream>
#include <cmath>

int main()
{
	using namespace std;
	double area;
	cout << "输入面积:" << endl;
	cin >> area;
	double side;
	side = sqrt(area);
	cout << "输出边长:" << side << endl;

	return 0;
}

第三章 处理数据

一天学一章:20240427

cpp 复制代码
#include <iostream>

int main()
{
	using namespace std;

	cout << "\aOperation \"Hyperhype\" is now activated:\n";
	cout << "Enter your agent code:________\b\b\b\b\b\b\b\b";

	long code;
	cin >> code;
	cout << "\ayou entered" << code << "...\n";

	return 0;
}
相关推荐
D e re k ZH12 小时前
P5025 [SNOI2017] 炸弹
c++·算法
wuminyu13 小时前
Java字节码学习总结:字节码如何加载、解析和执行
java·linux·c语言·jvm·c++
qq_4069810313 小时前
c++的decltype是什么
开发语言·c++
坤坤子吖13 小时前
算法学习——单调队列
开发语言·c++·笔记·学习·算法
杜 硕14 小时前
从零开始的C++生活——第六讲——01
开发语言·c++·生活
Risehuxyc16 小时前
C++(VS2026)使用Ncap库的配置
c++
4ever.ov016 小时前
精学C++第一站 从命名空间到引用:C++入门核心语法全梳理(13000字长文)
开发语言·c++·clion
听风若依17 小时前
C++模板初阶
c++·算法
纪念 22917 小时前
C++ 算法(模拟)
开发语言·c++·算法
zwc321043205518 小时前
Day 2:图像内存、数据类型与stride
c++·人工智能·opencv·算法·计算机视觉