首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C++
//设计一个计算图形面积的类库。
//类库的顶层是一个抽象类Shape,并且提供三个纯虚函数;显示数据成员、返回面积和返回体积。
//由Shape类派生Shape2D(二维图形)和Shape3D(三维图形),增加了有关的数据成员
//派生具体的图形类。
//Shape2D类派生Circle(圆)、Rectangle(矩形)。
//Shape3D类派生Ball(球体)、Cylinder(圆柱体)。
//在主函数测试中使用多态方式调用不同对象的求值函数。

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;
......................
阅读全部 | gougoudan 贴于 2020年6月13日 18:54     hide bbsi
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;

//创建一个抽象类
class Worker
{
public:
    Worker()
    {
        inum++;                 //静态变量的变化值
......................
阅读全部 | gougoudan 贴于 2020年6月13日 17:59     hide bbsi
#include<bits/stdc++.h>
 using namespace std;
 char a[10][10];
 int x,y,f;
 bool judge(int yy,int xx)
 {
 int c=yy,d=xx;
 for(int i=1;i<=4;i++)
 {
 if(a[c][d]!=a[++c][d]) break;
 if(i==4) return false;
 } 
......................
阅读全部 | l879800503 贴于 2020年6月10日 17:55     hide bbsi
#include <iostream>
#include <cstring>
using namespace std;

class Employee
{
public:
    virtual void pay(){ }   // 第一题 这一行不要
    string name;
    float  salary;
};

......................
阅读全部 | gougoudan 贴于 2020年6月8日 15:24     hide bbsi
#include <iostream>
#include <sstream>
#include <cstring>
#include <cassert>
using namespace std;

template <typename Type, int Count>
class Array
{
    enum { sz = Count };
    Type i[Count];

......................
阅读全部 | gougoudan 贴于 2020年6月8日 11:41     hide bbsi
#include <iostream>
using namespace std;

struct HuffNode
{
    float weight;
    int parent;
    int lchild;
    int rchild;
};

//实现哈夫曼编码, 返回根节点
......................
阅读全部 | gougoudan 贴于 2020年6月6日 22:34     hide bbsi
#include <iostream>
using namespace std;

struct HuffNode
{
    float weight;
    int parent;
    int lchild;
    int rchild;
};

//实现哈夫曼编码, 返回根节点
......................
阅读全部 | gougoudan 贴于 2020年6月6日 22:34     hide bbsi
#include <iostream>
#include <algorithm>
using namespace std;
void showarray(int a[], int c, int d)
{
    for (int i = 0; i < c; ++i)
        cout << a[i] << ' ';
    cout <<  endl;
}
//对a[low]到a[high]由小到大排序
bool QuickSort(int a[], int count, int teamIdx)
{
......................
阅读全部 | gougoudan 贴于 2020年6月6日 19:43     hide bbsi
#include <iostream>
#include <algorithm>
using namespace std;
void showarray(int a[], int c, int d)
{
    for (int i = 0; i < c; ++i)
        cout << a[i] << ' ';
    cout <<  endl;
}
//对a[low]到a[high]由小到大排序
bool QuickSort(int a[], int count, int teamIdx)
{
......................
阅读全部 | gougoudan 贴于 2020年6月6日 19:41     hide bbsi
#include <iostream>
#include <iomanip>
#include <cstring> // strcpy and strcat prototypes
#include <cstdlib> // exit prototype
using namespace std;

class String
{
    friend ostream &operator<<(ostream &, const String &);
    friend istream &operator>>(istream &, String &);
public:
    String(const char * = ""); // conversion/default constructor
......................
阅读全部 | gougoudan 贴于 2020年6月3日 14:48     hide bbsi
上一页 9 10 11 12 13 14 15 16 17 18 下一页