C++学习记录
文章平均质量分 53
UnlimitedHorizon
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++第6,7,8章
#include //如用VC++应改为∶#include using namespace std; //如用VC++应取消此行#include "cylinder.h"#include "point.cpp"#include "circle.cpp"#include "cylinder.cpp"int main(){Cylinder cy1(3.5,6.4,5.2原创 2015-06-15 16:53:11 · 553 阅读 · 0 评论 -
比较3个整数大小、c++
#includeusing namespace std;int main(){int a,b,c;cin>>a>>b;int max(int a,int b,int c=5);coutreturn 0;}int max(int a,int b,int c=5){if(aa=b;if(aa=c;return a;}原创 2015-03-23 23:19:02 · 2582 阅读 · 0 评论 -
引用,比较两数大小。8
#includeusing namespace std;int max(int &x,int &y){if(xx=y;return x;}int main(){int a,b;cin>>a>>b;coutreturn 0;}原创 2015-03-24 17:26:43 · 587 阅读 · 0 评论 -
排序。9
#includeusing namespace std;float sort(float &x,float &y,float &z){float t;if(x>y){t=x; x=y; y=t;}if(x>z){t=x;x=z;z=t;}if(y>z){t=y;y=z;z=t;}coutreturn 0;}int main(){flo原创 2015-03-24 17:51:33 · 487 阅读 · 0 评论 -
为什么程序运行不了?求解
#include#include"string"#include"cstring"using namespace std;class Person{int age;char *name;char gender;public:void display();Person():age(10),gender('M'){strcpy(name,"AAA");原创 2015-03-24 22:30:15 · 1318 阅读 · 0 评论 -
第二章
1 #include using namespace std;class Time {public:void set_time();void show_time();private: int hour; int minute; int sec;原创 2015-03-28 20:22:27 · 512 阅读 · 0 评论 -
1.12
#include#includeusing namespace std;int main(){string s[5];for(int m=0;mcin>>s[m];for(int i=0;ifor(int j=0;jif(s[j]>s[j+1]){string t;t=s[j];s[j]=s[j+1];s[j+1]=t;}for(原创 2015-03-28 20:44:59 · 436 阅读 · 0 评论 -
1.13和1.14
1.13#include #include using namespace std;int main( ){ longa[5]={10100,-123567, 1198783,-165654, 3456}; intb[5]={1,9,0,23,-45}; floatc[5]={2.4, 7.6, 5.5, 6.6, -2.3 }; voidsort原创 2015-03-28 21:09:37 · 686 阅读 · 0 评论 -
C++第三章
4.#include using namespace std; class Student {public: Student(int n,float s):num(n),score(s){} void display(); private: int num; float score; }; void Student::di原创 2015-04-20 16:10:09 · 940 阅读 · 0 评论 -
C++第四章
1:#include using namespace std;class Complex {public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} double get_real(); double get_imag(); void display(); pr原创 2015-04-26 20:10:30 · 540 阅读 · 0 评论 -
C++第五章
1:#include using namespace std;class Student{public: void get_value() {cin>>num>>name>>sex;} void display( ) {cout<<"num: "<<num<<endl; cout<<"name: "<<name<<endl; cout<<"sex:原创 2015-05-11 15:43:28 · 655 阅读 · 0 评论 -
Timedata
#include class Time{public: Time(){} Time(int h,int m,int s) { hour=h; minute=m; second=s; } friend istream & operator>>(istream &,Time &); friend ostream & operator<<(ostream &,Time &);原创 2015-05-18 23:13:35 · 492 阅读 · 0 评论 -
扩展三角形类求面积和打印
//扩展程序:创建一个三角形类//修改create_object函数,使得程序支持三角形的创建//和求面积、打印等操作#include #includeusing namespace std;#define OK 1#define ERROR -1class Shape { public: virtual double getArea() const =0; virtua原创 2015-05-19 20:49:29 · 753 阅读 · 0 评论 -
c++第二章
1#include <iostream>using namespace std;class Time {public:void set_time();void show_time();private: int hour; int minute; int sec; };void Time::set_time() { ci原创 2017-12-25 16:51:49 · 405 阅读 · 0 评论
分享