![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
Jacklucicc
这个作者很懒,什么都没留下…
展开
-
c++温故而知新
que遍历#include<iostream>#include<queue>using namespace std;int main(int argc, char* argv[]) { queue<int> myqueue; myqueue.push(1); myqueue.push(2); myqueue.push(3); int myqueue_size = myqueue.size(); for(int i = 0;原创 2021-02-04 10:17:44 · 115 阅读 · 0 评论 -
c++//union//20191222
#include<iostream>using namespace std;int main(){ struct s1 { char mark; long num; float score; }s1; union s2 { char mark; long num; float score; }s2; cout << sizeof(...转载 2019-12-22 15:38:26 · 236 阅读 · 0 评论 -
c++final exam test 2//20191222
Dec.22/2019#include"iostream"//1.3 1.28#include< iomanip>using namespace std;void main(){ double a=1.2846; cout<< setprecision(2)<<a<<endl; cout<<setiosflags(...原创 2019-12-22 14:02:33 · 106 阅读 · 0 评论 -
c++final exam test 3//20191222//待续中
Dec.22,20191.二维方阵主、次对角线的形成2.求二维方阵主、次对角线之和3.形成二维数组的上三角或下三角4.一维数组的左移n位,或右移n位5.求长方形的面积和周长6.求正方形的面积和周长7.求圆的面积和周长8.求n!9.比较两个数的大小10.比较两个字符串的大小11.求若干学生一门课的成绩总和、平均成绩、最高成绩、最低成绩等。12.求若干数的最大值或最小值13...原创 2019-12-22 14:03:41 · 146 阅读 · 0 评论 -
c++final exam test 1//20191221
#include<iostream>//15using namespace std;int sub(int);int main(){ int i = 5; cout << sub(i) << endl;}int sub(int n){ int a; if (n == 1) return 1; a ...原创 2019-12-21 21:38:59 · 234 阅读 · 1 评论 -
c++//2.三角形的种类和面积//20191211
#include <iostream>#include<cmath>#include<stdlib.h>using namespace std;class point{public: float x1, x2, y1, y2, z1, z2; point(float x1, float x2, float y1, float y2, float ...原创 2019-12-11 14:10:16 · 436 阅读 · 0 评论 -
c++//派生//20191210
编程实现:设计一个基类shape,从基类派生出圆,从圆派生出圆柱,设计成员函数,输出圆的面积和圆柱的体积/*作业:编程实现:设计一个基类shape,从基类派生出圆,从圆派生出圆柱,设计成员函数,输出圆的面积和圆柱的体积*/#include<iostream>using namespace std;class shape{public: shape() {}};cl...原创 2019-12-10 18:30:58 · 263 阅读 · 0 评论 -
c++//作业//20191207
实验二#include<cstdio>#include<iostream>#include<algorithm>using namespace std;class Array{public: Array(); Array(int *arr); Array operator +(Array a); void show...原创 2019-12-07 14:40:25 · 102 阅读 · 0 评论 -
c++//运算符重载//20191201
重载运算符的规则不允许用户定义新的运算符,只能对c++已有的运算符进行重载C++允许重载的运算符见表10.1(P313),不能重载的运算符有5个,见下页的表重载不能改变运算符运算对象(操作数)的个数重载不能改变运算符的优先级、结合性重载运算符的函数不能有默认的参数……(见书P313-314)C++中不允许重载的运算符运算符重载函数作为类成员函数重载运算符的函数一般形式:函数类...原创 2019-12-01 17:37:02 · 317 阅读 · 0 评论 -
c++//对象数组对象指针
#include <iostream>using namespace std;class Date{public: Date(int, int, int); Date(int, int); Date(int); Date(); void display();private: int month; int day; int year;};Date::Date...原创 2019-11-21 12:06:32 · 150 阅读 · 0 评论 -
c++//构造函数
#include"iostream"using namespace std;class Swap{private: double n1, n2;public: Swap(double x, double y) { n1 = x; n2 = y; } void swap() { double z; z = n1; n1 = n2; n2 = z; } voi...原创 2019-11-13 16:52:57 · 158 阅读 · 0 评论 -
Code is far away from bug with the animal protecting
/* * ┏┓ ┏┓+ + * ┏━┛┻━━━━━━┛┻━┓ + + * ┃ ┃ + + + * ┃ ━ ┃ + + + + * ┃ ████━████ ┃ * ┃ ┃ + + * ┃ ...转载 2019-11-11 21:10:35 · 324 阅读 · 0 评论 -
c/c++//随机数
1.随机数都只能是一次性的,如果你第二次运行的时候输出结果仍和第一次一样。这与srand()函数有关。#include<iostream>using namespace std;#include<stdio.h>#include<stdlib.h>#include<ctime>void main(){ for (int i = 0; ...转载 2019-11-11 19:32:54 · 84 阅读 · 0 评论 -
c++运行一个程序时如何打印出执行程序的时间
https://blog.csdn.net/weibo1230123/article/details/81383073#include<iostream>#include<time.h>//ctimeusing namespace std;void insert_sort(int a[], int len){ for (int i = 1; i < len...转载 2019-11-11 19:06:06 · 1720 阅读 · 0 评论 -
指针访问字符串
#include <iostream>using namespace std;int main()//指针str指向字符串常量//注意:常量只能读取不能修改{ char *str="I love CHINA!"; cout<<str[2] <<str[5]<<endl; cout<<str<<endl; r...原创 2019-11-10 15:35:44 · 1029 阅读 · 0 评论