笔记
时闻
数学与应用数学本科生
展开
-
pat甲级1032
pat1032#include<iostream>#include<map>#include<iomanip>using namespace std;int main(){ int a,b,r,p,n; char word; map<int,int> ma; cin>>a>>b>>n; for(int i=0;i<n;i++){ cin>>p>>word>>原创 2021-02-15 22:57:27 · 45 阅读 · 0 评论 -
c++复数类及其测试
c++复数类#include<iostream>using namespace std;struct complex{ double real; double imaginary;};void main(void){ int m,n; double x,y; complex c1,c2,c3; int add(int m,int n); double add(double x,double y); complex add(complex c1,complex c2)原创 2021-01-08 11:52:39 · 175 阅读 · 0 评论 -
c++ Matrix
c++ Matrix#include<iostream>using namespace std;int main(){ int line1[]={1,0,0}; int line2[]={0,1,0}; int line3[]={0,0,1}; int *pLine[3]={line1,line2,line3}; cout<<"Matrix test:"<<endl; for(int i=0;i<3;i++){ for(int j=0;j&l原创 2020-12-18 12:42:05 · 371 阅读 · 0 评论 -
c++复制构造函数
c++复制构造函数#include<iostream>using namespace std;class Point{public: Point(int xx=0,int yy=0){ x=xx; y=yy; } Point(Point &p); int getX(){ return x; } int getY(){ return y; } ~Point();private: int x,y;};Point::Point(Point &a原创 2020-12-11 12:12:44 · 114 阅读 · 0 评论 -
c++矩阵类
c++矩阵类#include<iostream>using namespace std;//定义矩阵类class Matrix{public: float Mat[20][20]={0}; void get_mat();//矩阵输入函数 void put_mat();//矩阵输出函数 Matrix operator+(Matrix &B);//运算符重载,矩阵加法 Matrix operator-(Matrix &B);//运算符重载,矩阵减法 Mat原创 2020-12-11 12:10:27 · 3334 阅读 · 1 评论 -
c++矩阵类1
c++矩阵类#include<iostream>using namespace std;int x = 0;//定义矩阵类class Matrix { public: float M[100]; void get_in(); int m=0,n=0,k=0;};void Matrix::get_in(){ x++; cout<<"please enter the"<<x<<"st matrix:"; char c; cin>原创 2020-12-11 12:08:36 · 198 阅读 · 0 评论 -
c++高斯列主元素消去法
c++高斯列主元素消去法求解线性方程组高斯列主元素消去法原理程序代码高斯列主元素消去法原理设有线性方程组Ax=bAx=bAx=b根据线性代数的知识,当detA!=0det A!=0detA!=0时,上述方程组的解存在且唯一,对增广矩阵(A,b)(A,b)(A,b)施行初等变换,化AAA为上三角矩阵,在初等变换过程中位于矩阵对角线上的元素称为主元素,为了避免较小数作为除数产生误差,每步消去时都将主元素所在列最大元所在行换到主元素所在行,然后再进行消元计算,此种方法称为高斯列主元素消去法。程序代码原创 2020-10-27 13:27:19 · 1617 阅读 · 1 评论