网站首页 站内搜索

搜索结果

查询Tags标签: cout,共有 1241条记录
  • C++调用Python-5:调用Python函数,传参数字+字符串

    # mytest.pydef myjoin(a, b):print("num a + str b")return f"{a}=={b}" #include "Python.h" #include <iostream> using namespace std;int main(int argc, char* argv[]) {Py_Initialize();if (!Py_IsInitialized()){cout <&l…

    2022/4/2 20:20:40 人评论 次浏览
  • 【算法基础】蓝桥杯入门算法

    一、STL库 1.动态数组vector<int> a .push_back() .pop.back() .size() .clear() 可能存在空间爆炸问题,用 vector<int> () .swap(v)来解决。 2.集合set<int> v .insert() .erase() .cout()比较方式:Bool operator<(const people…

    2022/3/31 9:19:31 人评论 次浏览
  • linux ptp同步 及 时间戳格式化输出

    ptp同步:https://blog.csdn.net/u013431916/article/details/83054369 用ptpd。对应的网口打开时钟协议即可。时间戳格式化输出:// 秒 毫秒 微秒 纳秒std::cout << "i++ status :timestamp count" << scans[i].headers.at(102).timestamp.count()…

    2022/3/29 7:27:44 人评论 次浏览
  • break和continue语句

    break语句 用于跳出选择结构或循环结构 1.switch语句中,终止case并且跳出switch。#include<iostream> using namespace std; #define CHINA "中国" int main() {//cout << "我爱中国" << endl;//cout << "1、很爱"…

    2022/3/28 23:31:30 人评论 次浏览
  • C++ 遍历map

    主要有两种方法 一种是auto:map<int, int> mp; for (auto p : mp) {cout << p.first << << p.second << endl; } 另一种是iterator迭代器:map<int, int> mp; map<int, int>::iterator iter; for(iter = mp.begin();iter…

    2022/3/27 20:22:34 人评论 次浏览
  • 一个排序小程序(上课)

    源程序: #include <iostream>using namespace std; void sort(int L[],int n){ int j,k,flag,temp; flag=n-1; while(flag>0) { k=flag-1; flag=0; for(j=0;j<=k;j++) { if(L[j]>L[j+1]) { temp=L[j]; L[j]=L[j+1]; L[j+1]=temp; fla…

    2022/3/27 11:52:41 人评论 次浏览
  • 内存管理模拟

    实验三. 内存管理 二、实验内容 ​ 假定页面大小为4K,物理内存128M,设计并实现一个内存分配和回收的程序,使用C语言或Python语言编写程序实现这个程序并进行测试。 ​ 要求:(1)至少5个进程; ​ (2)要求有空块管理; ​ (3)要求有一个逻辑地址到物理地址的变换。…

    2022/3/22 7:28:35 人评论 次浏览
  • [数据结构] 顺序表

    //#include <bits/stdc++.h> #include <iostream> #include <string> #define MAXSIZE 100 #define OK 1; #define ERROR 0; using namespace std;typedef int Status;typedef struct{string name;string gender;int age; }Student;typedef struct{Stud…

    2022/3/21 23:31:39 人评论 次浏览
  • 解释C++的模板

    书本解释: c++的模板是泛型编程的基础,它使的开发者可以使用一种与具体类型无关的方式来编写代码。模板相当于创建泛型类或泛型函数的一套公式。程序库中有很多容器,例如迭代器与算法都用到了泛型机制,他们采用模板来开发。每一种容器都只有一个定义,但是它所能容纳的…

    2022/3/21 17:28:27 人评论 次浏览
  • c++自制小游戏(不完美)

    我做的一个挖矿小游戏,后面会改进一些读入与输出,有建议的话记得评论区留言。 上代码: #include <bits/stdc++.h> using namespace std; struct block{ int type,hard; }; int xx=7,yy=0,hunger=100,money=0,strong=1; int price[100]={1,5,8,8,10,12,30,60,…

    2022/3/21 11:58:09 人评论 次浏览
  • C++ Prime Plus 编程练习 第三章

    1. 整数输入身高英寸,转为英尺英寸 #include <iostream>int main() {using namespace std;int inch;const int inch2foot = 12;cout << "Enter your height of inch:_\b";cin >> inch;cout << "your inch: " << inch …

    2022/3/20 20:34:29 人评论 次浏览
  • 读程序写结果_2

    源程序: #include <iostream>using namespace std; class Based{public: Based() { cout<<"Based构造函数\n"; fun(); } virtual void fun() { cout<<"Base::fun()函数\n"; }};class Derived:public Based{public: Derived() {…

    2022/3/20 17:30:37 人评论 次浏览
  • 牛客,第二十届北京师范大学程序设计竞赛,签到题7题

    序 题号 标题 已通过代码 通过率 团队的状态 A 小凯的疑惑 点击查看 434/745 通过 B 幻象踩花 点击查看 121/434 通过 C 跳刀抓人 点击查看 26/178 通过 D 真正的卡尔 点击查看 115/714 通过 E 刷新的艺术 点击查看 31/479 通过 F 最后的战役 点击查看 1/39 未通过 G 随机…

    2022/3/19 20:28:21 人评论 次浏览
  • C++ realloc后数据改变的问题

    由于之前没有使用过realloc函数,用之前做了一个测试。 long * a = new long[5]; for (long i = 0; i < 5; i++) { a[i] = i; } for (long i = 0; i < 5; i++) { cout << a[i] << endl; } cout << endl;a = (long *)realloc(a, 6); a[5] = 6; for…

    2022/3/19 20:28:16 人评论 次浏览
  • C++ Primer阅读心得(第十七章)

    C++ Primer阅读心得(第十七章) c++11标准库中新增了临时数据组合的tuple类型(python万岁!)。类似pair,我们可以通过make_tuple创造一个tuple,通过get获得其中的一个元素,通过tuple_size获得tuple中的元素个数,通过tuple_element获得tuple中指定元素的类型。tuple…

    2022/3/19 1:28:08 人评论 次浏览
扫一扫关注最新编程教程