源代码
文章平均质量分 68
带电体
积累电量
展开
-
输入10个数,并用冒泡排序法排序
#include using namespace std;int main(){ int a[10],k=0; for(int i=0;i<10;i++) { cin>>a[i]; } int temp; for(int i=0;i<10;i++) { for(int j=0;j<10;j++) if(a[j]>a[j+1]) { temp=a[j];转载 2017-12-30 20:29:06 · 10889 阅读 · 1 评论 -
重载运算符的两种方式
第一种就是把运算符重载函数作为类内成员函数,他可以通过this 指针自由的访问本类的数据成员,因此可以少些一个参数Complex operator +(Complex &);以下是把运算符重载函数作为类内成员函数 重载‘+’的源代码#include using namespace std;class Complex{ public: Complex(int ,int );原创 2018-01-02 19:07:22 · 4932 阅读 · 1 评论