自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 c++面试题(亲测常问)

注意:此题为我自己面试被问到的,及一些摘抄的,如有侵权请联系我马上删除!1.2.32位指针地址所占字节数为四举例说明:char*p;char test[10];p=test;sizeof(p)=4(32位系统) //实质是求指针类型所占字节数,32位对应4字节,64位对应8字节sizeof(*p)=1 //实质是求指针所指的内容所在字节数,*p=char[0],当然所指内容大小等于1字节sizeof(test)=10 //虽然数....

2022-05-27 18:10:30 2848

原创 ImageNet-1K数据集获取

好大的数据集..

2024-03-14 09:12:09 567

原创 逻辑回归损失代价函数

2023-05-05 15:56:46 106

原创 逻辑回归(Logistic Regression)

2023-05-05 14:36:16 108

原创 二分分类.

阵,它们分别对应图片中的红、绿、蓝三种颜色通道,如果你的图片大小为64x64像素,那么你就有三个规模为64x64的矩阵,分别对应图片中红、绿、蓝三种像素的强度值。二分类问题中,我们的目标就是习得一个分类器,它以图片的特征向量作为输入,然后预测输出结果y为1还是0,也就是预测图片中是否有猫。向量来表示这张图片,我们把所有的像素都取出来,例如255、231等等,直到取完所。维度,将是64乘以64乘以3,这是三个像素矩阵中像素的总量。为了把这些像素值放到一个特征向量x中,我们需要把这些像素值提取出来,然后放入。

2023-05-04 22:45:18 327

原创 神经网络概述

2023-05-04 22:43:27 71

原创 vector 和 map最全总结

vector是一个可以动态分配内存的数组,需要头文件 #include <vector>初始化常见函数的使用1.push_back 在数组的最后添加一个数据2.pop_back 去掉数组的最后一个数据3.at 得到编号位置的数据4.begin 得到数组头的指针(迭代器常用)vector<int>::iterator it1 = vec1.begin();5.end 得到数组的最后一个单元+1的指针(与begi......

2022-05-31 17:57:33 3813 1

转载 stl基础总结-转载

只转载了一些基础知识 原文链接在文末各大容器的特点:1.可以用下标访问的容器有(既可以插入也可以赋值):vector、deque、map;特别要注意一下,vector和deque如果没有预先指定大小,是不能用下标法插入元素的!2. 序列式容器才可以在容器初始化的时候制定大小,关联式容器不行;3.注意,关联容器的迭代器不支持it+n操作,仅支持it++操作。一、vector当需要使用数组的情况下,可以考虑使用vector1.特点:(1) 一个动态分配的数组(当..

2022-05-28 15:48:39 136

原创 vector容器存放自定义数据类型及指针

#include<iostream>using namespace std;#include<vector>class person{public: person(string a, int b) :name(a), age(b) {} string name; int age;};void text01() { vector<person> v; person p1("a",11); person p2("b", 12); person p.

2022-04-05 21:54:28 472

原创 vector容器存放内置数据类型

#include<iostream>using namespace std;#include<vector>#include<algorithm>//标准算法头文件//vector容器存放内置数据类型void print(int val) {//第三种遍历需要的函数 cout << val<<endl;}void test01() { //创建一个vector容器:理解为数组就行,可以在任意位置插入的数组。 vec.

2022-04-05 21:11:20 350

原创 栈和堆超详细解释

栈区:函数形参 和 局部变量 由编译器来进行释放(具体看注释) 地址连续#include<iostream>using namespace std;//不要反悔局部变量的地址//栈区由编译器自动释放。int* fun(int b) {//形参数据也会在栈区 int b = 100; int p=10;//局部变量存放在栈区,栈在函数执行完成后自动释放。 return &p;}int main() { int *p = fun(1);//接受fun的返回值..

2022-04-05 20:20:07 171

原创 c+简易通讯录制作

#include <iostream>using namespace std;#define max1 100//define 的定义方式!!!struct Person { string name; int age;};struct addressbook { Person person [max1]; int maxpeople;};void showbook1(addressbook* p) { for (int i = 0; i < p->maxp.

2022-04-05 19:29:52 470

原创 vs中只运行一个项目

再运行即可

2022-04-05 10:43:37 617

原创 纯虚函数和抽象类

//包含纯虚函数的类称为 抽象类。由于抽象类包含了没有定义的纯虚函数,所以不能定义抽象类的对象。#include<iostream>using namespace std;class shape {//shape 为抽象类public: virtual void area() { cout << "wu" << endl; } virtual void display()const = 0;//纯虚函数 //在基类中为其派生类保留一个函数名称,以便派.

2022-03-21 14:44:43 322

原创 虚析构函数

当派生类的对象从内存中撤出时候,一般先调用派生类的析构函数,再调用基类的析构函数。但是如果用nex运算符建立一个临时对象,系统只会执行基类的析构函数,而不执行派生类的析构函数。示例:#include<iostream>using namespace std;class Point {public: Point(int a, int b) :x(a), y(b) {} void display() { cout << x << ":" <

2022-03-21 14:02:19 359

原创 虚函数和多态性

1.多态性的表现形式之一就是,具有不同功能的函数用同一个函数名,这样可以实现一个函数名调用内容不同的函数。2.多态分为两类:动态多态 静态多态。函数重载,运算符重载就属于静态的,静态多态性又称在编译时的多态性。动态多态就是不在编译时确定调用哪个函数,而在程序运行中动态的确定操作所针对的对象。动态多态性是通过虚函数来实现的虚函数示例:#include<iostream>using namespace std;class student {public: student

2022-03-21 10:45:00 923

原创 虚基类简介

#include<iostream>using namespace std;class person {public: person(string name, int num): name(name),num(num) { cout << "person 输出" << endl; }private: string name; int num;};class teacher :virtual public person {public: te.

2022-03-20 15:23:11 562

原创 多重派生及有子对象的构造函数

#include<iostream>using namespace std;class student {public: student(int a, string b) :num(a), name(b) { cout << "基类先来" << endl; }private: int num; string name;};class student1 :public student {public: student1(int a, st.

2022-03-20 14:07:40 366

原创 三种继承方式详解

#include<iostream>using namespace std;class student {public: int num;private: string name;protected: int sex;};class student1 :public student {public: void fun() { num = 1;//继承过来是public //name = "wc";//基类private的始终是无法访问 sex = 1;//.

2022-03-20 12:36:39 71

原创 重载前置后置运算符代码(以计算时间)

#include<iostream>using namespace std;class time1 {public: time1() { min = 0; sec = 0; } time1(int a, int b) :min(a), sec(b) {} time1 operator ++(); time1 operator ++(int); friend ostream&operator << (ostream&, time1&.

2022-03-20 10:51:04 71

原创 转换构造函数和类型转换函数

#include<iostream>using namespace std;class complex {public: complex() { real = 0, image = 0; } complex(int a, int b) :real(a), image(b) {} complex(int a) {//装换构造函数 real = a; image = 0; } operator int() { return real; }//类型转换函数.必须为成员函数.

2022-03-19 16:05:47 75

原创 重载单目运算符前置后置问题

#include<iostream>using namespace std;class complex{public: complex(int a = 0, int b = 0) :real(a), imag(b) {} complex operator++();//前置 complex operator++(int);//后置 friend ostream&operator << (ostream&, complex&); friend .

2022-03-19 14:07:48 296

原创 运算符重载

#include<iostream>using namespace std;class complex{public: complex() { real = 0; imag = 0; } void display(); complex(int a, int b) :real(a), imag(b) {} friend complex operator +(complex& c1, complex& c2);//友元函数重载+ 无this 需要两个参数.

2022-03-19 10:24:07 119

原创 友元函数和成员函数两种方法重载运算符以及重载流运算符

#include<iostream>using namespace std;class complex{public: complex() { real = 0; imag = 0; } void display(); complex(int a, int b) :real(a), imag(b) {} friend complex operator +(complex& c1, complex& c2);//友元函数重载+ 无this 需要两个参数.

2022-03-19 10:22:16 988

原创 类模板使用

#include<iostream>using namespace std;template<class t1>class compare{public: compare(t1 a, t1 b) :a(a), b(b) {} void max();private: t1 a, b;};template<class t1>//类外定义 函数模板中成员函数的写法void compare<t1>::max(){ if (a>b.

2022-03-19 09:23:27 62

原创 友元成员函数

#include<iostream>using namespace std;class Date;class Time{public: Time(int a, int b, int c) :hour(a), min(b), sex(c) {} void display(Date );private: int hour, min, sex;};class Date{public: Date(int a, int b , int c) :year(a), month(.

2022-03-18 21:51:04 461

原创 静态函数和静态数据成员实现求平均分

#include<iostream>using namespace std;class student{public: student(int a, int b, float c) :num(a),age(b),score(c) {};//静态不能在构造初始化 void total(); static float average(); static float sum;private: int num, age; float score; //静态数据必须类外定义26 .

2022-03-18 20:55:21 522

原创 指向常对象的指针变量和指向对象的常指针

#include<iostream>using namespace std;class time1{public: time1(int a=0, int b=0, int c=0) :hour(a),min(b),sex(c) {} void display(); void show()const; void set(int a, int b, int c) { hour = a; min = b; sex = c; }private: int hour, .

2022-03-18 10:28:21 115

原创 常对象与常成员函数

#include<iostream>using namespace std;class time1{public: time1(int a, int b, int c) :hour(a),min(b),sex(c) {} void display(); void show()const;//常成员函数 void set(int a, int b, int c) { hour = a; min = b; sex = c; }private: int hour,.

2022-03-18 09:55:33 187

原创 有关对象的三种指针

主要写了三种,注释挺详细的,看代码吧#include<iostream>using namespace std;class time1{public: time1(int a, int b, int c) : hour(a), min(b), sec(c) {} void show(); int hour;private: int min; int sec;};void time1::show(){ cout << hour << "

2022-03-17 16:18:31 54

原创 对象数组使用

#include<iostream>using namespace std;class box{public: box(int a , int b = 1, int c = 1); int he();private: int h, w, len;};box::box(int a,int b,int c) { h = a; w = b; len = c;}int box::he(){ int sum = h * w * len; return sum .

2022-03-17 15:17:43 34

原创 析构函数基础

析构函数:1.作用并不是删除对象,而是在撤销对象占用内存之前完成一些清理工作;2.没有返回值,没有类型参数,也没有函数参数,可以有多个构造,但只能一个析构。3.简单来说就是用户希望对象在最后一次执行的操作。#include<iostream>using namespace std;class student{public: student(int a = 0, string b = "0", int c = 0) :num(a), name(b), sex(c) {}

2022-03-17 14:59:43 43

原创 构造函数基础讲解

#include<iostream>using namespace std;class box{public: box() { h = 1; w = 1; len = 1; } box(int a, int b, int c); int he();private: int h, w, len;};box::box(int a, int b, int c) :h(a), w(b), len(c) {};int box::he(){ int sum = .

2022-03-17 13:46:53 178

原创 枚举类型举例

#include<iostream>using namespace std;int main() { enum week {sun,mom,tue=5,wed,thu,fri,sat }; week day1,day2,day3; //枚举会输出数,从0开始 sun就是0; day1 = tue; day2 = sun;//没给默认就是从0起,依次递增; day3 = wed; //day3 =wed+1;错误的 可以如下令day+1; cout << d.

2022-03-16 16:17:35 107

原创 new delete和指向结构体指针的使用

#include<iostream>using namespace std;struct student{ string name; int num; int sex;};int main() { student* p,*q,stu; p = new student{ "dema",104323,1 };//用new新开辟了一个存放student型数据的空间,把地址给了p; /*p->name = "dema"; p->num = 1043320140; .

2022-03-16 15:21:47 1215

原创 结构体数组实现简单投票代码

#include<iostream>using namespace std;#define length 3;struct person { char name[20]; int count;};int main() { person leader[3] = { "li",0,"dema",0,"wa",0 }; char name[20]; for (int i = 0; i < 4; i++) { cin >> name; for (int .

2022-03-16 14:18:09 302

原创 引用的使用及注意事项

注释挺全的,看注释吧#include<iostream>using namespace std;void fun(int&, int&);int main() { int a = 3,c=4; int& b = a; cout << b << endl; //1.int& b = c;错误; 声明一个引用后不可以作为另一个引用 //2.声明引用必须同时初始化. //3.int &n=a[0]不能建立数组引用.

2022-03-16 10:54:46 129

原创 指针数组,指向字符的指针数组含义

话不多说先来代码:#include<iostream>using namespace std;#define MAX 5//符号常量 无;int main() { // char* name[] = { "jack","rose","c++" }; // 不兼容会报错! char* name[] = { (char*)"jack",(char*)"rose",(char*)"c++" };//解决办法:强制转换; // name[]分别存放着这3个字符串的首地址

2022-03-16 10:26:50 691

原创 const指针

#include<iostream>using namespace std;int main() { int a=1, b=2; const int * p; //指向常量的指针变量; p = &a; cout << *p << endl; //*p = a; 不可修改 int * const q=&b; //常指针; // q = &a; 不可修改 *q = *p; //此处改变了b的值, 因为* p取的b的地址;.

2022-03-16 09:35:42 285

原创 指向函数的指针

#include<iostream>using namespace std;int (*p)(int, int);int max(int x, int y);int main() { p = max; cout<<max(5, 6)<<endl; cout << p(7, 8);}int max(int a, int b) { if (a > b) return a; else { return b; }}.

2022-03-15 15:44:40 26

空空如也

空空如也

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

TA关注的人

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