C++ Primer Plus

第一章 初始C++

#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 使用有返回值的函数

#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;
}

第三章 处理数据

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-27 03:18:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-27 03:18:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-27 03:18:03       82 阅读
  4. Python语言-面向对象

    2024-04-27 03:18:03       91 阅读

热门阅读

  1. manim

    2024-04-27 03:18:03       35 阅读
  2. Mysql索引篇

    2024-04-27 03:18:03       29 阅读
  3. 什么是prettier的glob 模式

    2024-04-27 03:18:03       33 阅读
  4. 【DataGrip】 sql语句:模糊搜索

    2024-04-27 03:18:03       35 阅读
  5. 删除有序序列中的重复项 python

    2024-04-27 03:18:03       34 阅读
  6. Jammy@Jetson Orin - Tensorflow & Keras Get Started

    2024-04-27 03:18:03       30 阅读
  7. 面试题:判断一个完全平方数

    2024-04-27 03:18:03       27 阅读
  8. Ali-Sentinel-入口控制

    2024-04-27 03:18:03       30 阅读
  9. SQL数据更新

    2024-04-27 03:18:03       26 阅读
  10. Vue-3

    Vue-3

    2024-04-27 03:18:03      32 阅读
  11. C# 面向对象编程(一)——类 第三篇

    2024-04-27 03:18:03       34 阅读
  12. DataGridView控件

    2024-04-27 03:18:03       35 阅读