网站首页 站内搜索

搜索结果

查询Tags标签: cout,共有 1241条记录
  • 剑指offer_剪绳子(C++_动态规划/图解贪心算法)

    原题链接文章目录 动态规划1.思路2.动态规划C++代码3.代码注意贪心算法1.思路①证明一②证明二2.C++贪心算法代码动态规划 1.思路 可以分析出来,因为题目要求必须剪。当绳子的长度小于2的时候不能剪了,这里返回0。当长度为2时只能11,乘积为1。当长度为3时最大乘积为12=…

    2021/9/29 20:41:13 人评论 次浏览
  • C++结构体 结构体定义和使用、结构体数组、结构体指针、结构体嵌套结构体、结构体做函数参数

    C++结构体 第二章 C++结构体1.结构体定义和使用 语法:struct 结构体名 { 结构体成员列表 }; 通过结构体创建变量的方式有三种: struct 结构体名 变量名struct 结构体名 变量名 = { 成员1值 , 成员2值…}定义结构体时顺便创建变量 //.cpp #include "structuralMes…

    2021/9/29 11:40:50 人评论 次浏览
  • C++结构体 结构体定义和使用、结构体数组、结构体指针、结构体嵌套结构体、结构体做函数参数

    C++结构体 第二章 C++结构体1.结构体定义和使用 语法:struct 结构体名 { 结构体成员列表 }; 通过结构体创建变量的方式有三种: struct 结构体名 变量名struct 结构体名 变量名 = { 成员1值 , 成员2值…}定义结构体时顺便创建变量 //.cpp #include "structuralMes…

    2021/9/29 11:40:50 人评论 次浏览
  • 9.28

    今天编写了用栈实现回文的代码. 代码如下: #include<iostream>using namespace std;const int Maxsize = 100;class stact {public: char data[Maxsize]; int top = 0; void push(char b) { data[++top] = b; } char pop() { return…

    2021/9/28 23:41:47 人评论 次浏览
  • 9.28

    今天编写了用栈实现回文的代码. 代码如下: #include<iostream>using namespace std;const int Maxsize = 100;class stact {public: char data[Maxsize]; int top = 0; void push(char b) { data[++top] = b; } char pop() { return…

    2021/9/28 23:41:47 人评论 次浏览
  • C++多线程编程第四讲--创建多个线程、数据共享问题分析、案例代码

    //(1)创建和等待多个线程 #include<iostream> #include<thread> #include<vector>using namespace std;void myprint(int num) {cout << "this thread id = " << std::this_thread::get_id() << " num = " <&…

    2021/9/28 9:11:04 人评论 次浏览
  • C++多线程编程第四讲--创建多个线程、数据共享问题分析、案例代码

    //(1)创建和等待多个线程 #include<iostream> #include<thread> #include<vector>using namespace std;void myprint(int num) {cout << "this thread id = " << std::this_thread::get_id() << " num = " <&…

    2021/9/28 9:11:04 人评论 次浏览
  • 菜学C++ Day4

    setw(n)函数:用于设置输出字段的宽度 字段长度<n,在前面默认用空格补齐(相当于右对齐)(可以用setfill(‘x),x为补齐符号) 字段长度>n,字段全部输出,不受宽度限制 #include<iomaip> cout << setfill(!) << setw(8) << "nice&q…

    2021/9/28 1:40:46 人评论 次浏览
  • 菜学C++ Day4

    setw(n)函数:用于设置输出字段的宽度 字段长度<n,在前面默认用空格补齐(相当于右对齐)(可以用setfill(‘x),x为补齐符号) 字段长度>n,字段全部输出,不受宽度限制 #include<iomaip> cout << setfill(!) << setw(8) << "nice&q…

    2021/9/28 1:40:46 人评论 次浏览
  • 队列实现回文

    #include<iostream>#include<queue>#include<string>using namespace std;int main(){ queue<char>S1; queue<char>S2; string s; getline(cin,s); for(int j=0;j<s.length();j++){ if(s[j]== ){ for(int m=j;m<s.length();m++)…

    2021/9/27 23:12:58 人评论 次浏览
  • 队列实现回文

    #include<iostream>#include<queue>#include<string>using namespace std;int main(){ queue<char>S1; queue<char>S2; string s; getline(cin,s); for(int j=0;j<s.length();j++){ if(s[j]== ){ for(int m=j;m<s.length();m++)…

    2021/9/27 23:12:58 人评论 次浏览
  • C++学习笔记28:基于范围的 for 循环(C++11)

    C++11新增了一种循环:基于范围(range-based)的 for 循环。这简化了一种常见的循环任务:对数组(或容器类,如 vector 和 array)的每个元素执行相同的操作,如下例所示: #include <iostream> int main() {using namespace std;double price[5] = { 4.99, 10.99…

    2021/9/27 17:12:51 人评论 次浏览
  • C++学习笔记28:基于范围的 for 循环(C++11)

    C++11新增了一种循环:基于范围(range-based)的 for 循环。这简化了一种常见的循环任务:对数组(或容器类,如 vector 和 array)的每个元素执行相同的操作,如下例所示: #include <iostream> int main() {using namespace std;double price[5] = { 4.99, 10.99…

    2021/9/27 17:12:51 人评论 次浏览
  • C++前期知识实现简单的通讯录系统

    #include<iostream> using namespace std; void showMenu(); void end0(); #define max 1000struct News {string name;string sex;int age;int phone;string site; }; struct books {struct News news[max];int size; };void showMenu() {cout << " 1.…

    2021/9/27 14:11:02 人评论 次浏览
  • C++前期知识实现简单的通讯录系统

    #include<iostream> using namespace std; void showMenu(); void end0(); #define max 1000struct News {string name;string sex;int age;int phone;string site; }; struct books {struct News news[max];int size; };void showMenu() {cout << " 1.…

    2021/9/27 14:11:02 人评论 次浏览
扫一扫关注最新编程教程