自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 函数模板与后置返回类型

#include<iostream>using namespace std;template <class T> auto swap(T *a,int b=5)->decltype(a) //函数模板与后置返回类型{ T *max = &a[0]; for (int i = 0; i < b; i++) { *max = a[i] > *max ? a[i] : *max; } cout << *max << e

2021-03-20 13:08:03 70

原创 c++函数指针的简单使用

标题 c++函数指针的简单使用在这里插入代码片#include <iostream>using namespace std;double add(double x, double y) { return x + y; }double cut(double x, double y) { return x - y;}double * sum(double(*pf)(double, double),double(*pt)(double,double), double a, d

2021-03-17 21:47:59 51

原创 利用递归函数求阶乘!

using namespace std;int ptr(int n);int main(){ int num; cout << "Enter a number:\n"; while (cin>>num) //当输入不是int型数字时结束循环 { cout << ptr(num) << endl; cout<< "Enter a number:\n"; } cout .

2020-09-24 21:15:03 444

原创 要求输入一个值,指出显示多少行。然后程序将显示星号,在星号不够时,将显示句点。

#includeint main(){using namespace std;int count=0;cout << "Enter star's number:\n";cin >> count;for (int i = 1; i <=count; ++i) //最好设置为1{ for (int j = 1; j <= count - i; j++) { cout << '.'; } for (int j = 1; j <=

2020-09-19 22:09:10 99

原创 Bresenham画线算法简单实线

#include<freeglut.h>#include<cmath>typedef GLint Vertex3[3];GLint winwidth = 300, winheight = 300;void reshapeFcn(GLint newwidth,GLint newheight){ glViewport(0, 0, newwidth, newheig...

2020-04-12 18:00:28 184

原创 openGL简单使用

#include<GL/freeglut.h> //glut.h 也可以GLfloat angle = 0.0f;void Reshape(GLint w,GLint l) //窗口改变函数{ glViewport(0, 0, w, l);}void myDisplay(GLvoid){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH...

2020-03-21 20:42:11 257

原创 #单利,复利。Daphne,Cleo。

#include <iostream>using namespace std;void main(){ double z1=100, z2=100,z3=100; int year=0; while (z3<=z1) { year++; z1 = 100 + 10 * year; z3 = z2*1.05; z2 = z2*1.05; } c...

2020-02-27 22:30:27 114

原创 #编写一个要求用户输入数字的程序。每次输入后,程序都将报告到目前为止,所有输入的累计和。当用户输入0时,程序结束。

#include <iostream>using namespace std;const int Size = 20;void main(){ int arr[Size] = { 0 }; int ch,zong=0; int i = 0; cout << "enter a num:\n"; cin>>ch; while (ch != 0...

2020-02-27 22:00:59 1892 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除