实验三

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实验三相关的知识,希望对你有一定的参考价值。

#include<iostream>
using namespace std;
class retangle{
	public:
		retangle(double x,double y); 
		double area();
		private:
			double length,width;
};
retangle::retangle(double x, double y)
{
	length=x;
	width=y;
}
double retangle::area()
{
	return length*width;
}
int main()
{
	double length,width;
	cout<<"Please enter the length and the width:";
	cin>>length>>width;
	retangle c(length,width);
	cout << c.area()<<endl;
	return 0;
}

#include<iostream>
using namespace std;
class complex{
    public:
      complex(double r,double i);
      void add(complex c2);
      void show();
    private:
      double real,imaginary;
         
};
complex::complex(double r,double i)
{
    real= r;
    imaginary=i;
}
void complex::add(complex c2){
    real+=c2.real;
    imaginary+=c2.imaginary;
}
void complex::show(){
    cout<<real<<"+"<<imaginary<<"i"<<endl;
}
int main()
{
    complex c1(3.0,5.0);
    complex c2(4.5,0);
    c1.add(c2);
    c1.show();
    return 0;
}

以上是关于实验三的主要内容,如果未能解决你的问题,请参考以下文章

汇编实验五

实验四

验证码逆向专栏极验三代四代点选类验证码逆向分析

C++项目三代码参考(改进版)

实验五

JSP 设计教师与学生不同登陆界面(带验证码)