网站首页 站内搜索

搜索结果

查询Tags标签: cout,共有 1241条记录
  • 第一章 C++基本编程

    编写一个最简单的C++程序 C++程序必须有 main() 函数作为程序入口;cout 和 cin 都是标准输入输出库中提前定义好的一个类对象,用于向终端或者文件进行输入输出操作;\n: 换行\t: 一个tab #include <iostream> // 基本输入输出头文件 #include <string> // 字…

    2021/11/29 1:06:06 人评论 次浏览
  • 第一章 C++基本编程

    编写一个最简单的C++程序 C++程序必须有 main() 函数作为程序入口;cout 和 cin 都是标准输入输出库中提前定义好的一个类对象,用于向终端或者文件进行输入输出操作;\n: 换行\t: 一个tab #include <iostream> // 基本输入输出头文件 #include <string> // 字…

    2021/11/29 1:06:06 人评论 次浏览
  • C++两个类互相调用对方成为自己的数据成员

    添加数据成员时,不能是单纯的类对象,必须至少有一方是指针。 如 #include<iostream> using namespace std; class B;//必须要对后面的进行前置声明class A { public:int score=1;B *b; }; class B { public: int score = 2;A a;}; int main() {A T_1;B S_1; cout&…

    2021/11/29 1:06:02 人评论 次浏览
  • C++两个类互相调用对方成为自己的数据成员

    添加数据成员时,不能是单纯的类对象,必须至少有一方是指针。 如 #include<iostream> using namespace std; class B;//必须要对后面的进行前置声明class A { public:int score=1;B *b; }; class B { public: int score = 2;A a;}; int main() {A T_1;B S_1; cout&…

    2021/11/29 1:06:02 人评论 次浏览
  • C++ string实用总结

    数字类型转为string字符串 to_string(num); #include<bits/stdc++.h>using namespace std;int main(){int n = 123456;string str = to_string(n);cout << str;return 0; }string字符串转为数字类型 stoi(int),stol(long), stof(float), stod(double) #includ…

    2021/11/28 20:40:56 人评论 次浏览
  • C++ string实用总结

    数字类型转为string字符串 to_string(num); #include<bits/stdc++.h>using namespace std;int main(){int n = 123456;string str = to_string(n);cout << str;return 0; }string字符串转为数字类型 stoi(int),stol(long), stof(float), stod(double) #includ…

    2021/11/28 20:40:56 人评论 次浏览
  • c++线性栈及链栈

    黑书作者的异常头文件 myexception.h// exception classes for various error types#ifndef myExceptions_ #define myExceptions_ #include <string> #include<iostream> using namespace std;// illegal parameter value class illegalParameterValue { pub…

    2021/11/28 20:40:01 人评论 次浏览
  • c++线性栈及链栈

    黑书作者的异常头文件 myexception.h// exception classes for various error types#ifndef myExceptions_ #define myExceptions_ #include <string> #include<iostream> using namespace std;// illegal parameter value class illegalParameterValue { pub…

    2021/11/28 20:40:01 人评论 次浏览
  • C++ bind和function

    bind1st 和bind2nd bind1st : operator()的第一个形参变量绑定成一个确定的值 bind2nd : operator()的第二个形参变量绑定成一个确定的值实例: 将数组从大到小排序后,按顺序插入70 #include <iostream> #include <vector> #include <functional> #in…

    2021/11/28 17:10:21 人评论 次浏览
  • C++ bind和function

    bind1st 和bind2nd bind1st : operator()的第一个形参变量绑定成一个确定的值 bind2nd : operator()的第二个形参变量绑定成一个确定的值实例: 将数组从大到小排序后,按顺序插入70 #include <iostream> #include <vector> #include <functional> #in…

    2021/11/28 17:10:21 人评论 次浏览
  • 【c++】运动会1.1.1

    我修复了Windows7系统运行太快的BUG 对了,这个也要下载b_game3.0 #include<iostream> #include<conio.h> #include<windows.h> #include<D:\b_game.h> #include<ctime> #include<cstdlib> using namespace std; using namespace _ga…

    2021/11/28 14:09:51 人评论 次浏览
  • 【c++】运动会1.1.1

    我修复了Windows7系统运行太快的BUG 对了,这个也要下载b_game3.0 #include<iostream> #include<conio.h> #include<windows.h> #include<D:\b_game.h> #include<ctime> #include<cstdlib> using namespace std; using namespace _ga…

    2021/11/28 14:09:51 人评论 次浏览
  • 枚举算法——①基础

    枚举算法: **定义: 根据提出问题,列出该问题的所有可能的解,并在逐一列出的过程中,检验每个可能解是否是问题的真正解(如果是,则采纳这个解,否则继续判断下一个)。 **应用: 枚举法往往适合解决较简单的题目,这类题目的特点: 1)枚举范围是有穷的; 2)检验条件是…

    2021/11/27 17:13:48 人评论 次浏览
  • 枚举算法——①基础

    枚举算法: **定义: 根据提出问题,列出该问题的所有可能的解,并在逐一列出的过程中,检验每个可能解是否是问题的真正解(如果是,则采纳这个解,否则继续判断下一个)。 **应用: 枚举法往往适合解决较简单的题目,这类题目的特点: 1)枚举范围是有穷的; 2)检验条件是…

    2021/11/27 17:13:48 人评论 次浏览
  • 菜学C++ Day56 OJ题目1190 对角线I

    我的解法:直接是两个for循环当i==j的时候输出1 #include<iostream> #include<iomanip> using namespace std;int main() {int n;cin >> n;for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {if (i == j)cout << setw(3) <<…

    2021/11/26 17:10:53 人评论 次浏览
扫一扫关注最新编程教程