求几个小程序的c++代码
学了c++一段时间,想看看一般人家的程序怎么写的,想学着弄一下软件神马的。。。想看看一些比较简单的软件的程序是怎么样的感觉上像迅雷美图看看那神马的(不知道复杂不。。)还有...
学了c++一段时间,想看看一般人家的程序怎么写的,想学着弄一下软件神马的。。。
想看看一些比较简单的软件的程序是怎么样的
感觉上像迅雷美图看看那神马的(不知道复杂不。。)还有一些小程序,如果哪位大大有的麻烦能给我一下么。。具体什么程序不怎么要紧,主要想看看学习学习(最好是实用程序吧,不要专为教学而编的那种) 展开
想看看一些比较简单的软件的程序是怎么样的
感觉上像迅雷美图看看那神马的(不知道复杂不。。)还有一些小程序,如果哪位大大有的麻烦能给我一下么。。具体什么程序不怎么要紧,主要想看看学习学习(最好是实用程序吧,不要专为教学而编的那种) 展开
4个回答
展开全部
迅雷那种东西是不会开放源代码的,要找的话可以上开源社区看看,比如http://www.codeproject.com/,上面就有好多有趣的小工具,注释也比较好。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<iostream>
#include<cmath>
using namespace std;
const double PI=3.14;
class Shape
{
public:
virtual void Area()=0;
virtual ~Shape(){}
};
class TwoDimShape:virtual public Shape
{};
class ThreeDimShape:virtual public Shape
{
protected:
double height;
public:
ThreeDimShape(double h){height=h;}
};
class Circle:public TwoDimShape
{
protected:
double radius;
public:
Circle(double r)
{
radius=r;
}
void Area()
{
cout<<"Area of circle is:"<<PI*radius*radius<<endl;
}
};
class Rectangle:public TwoDimShape
{
protected:
double width,length;
public:
Rectangle(double w,double l)
{
width=w;
length=l;
}
void Area()
{
cout<<"Area of rectangle is:"<<width*length<<endl;
}
};
class Ladder:public Rectangle
{
protected:
double downlen;
public:
Ladder(double w,double l,double d):Rectangle(w,l)
{
downlen=d;
}
void Area()
{
cout<<"Area of ladder is:"<<(length+downlen)*width/2<<endl;}
};
class Cylirder:public ThreeDimShape,public Circle
{
public:
Cylirder(double r,double h):Circle(r),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of cylirder is:"<<2*PI*radius*height+2*PI*radius*radius<<endl;
}
};
class Cube:public ThreeDimShape,public Rectangle //正方体
{
public:
Cube(double w,double l,double h):Rectangle(w,l),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of cube is:"<<2*(width*length+width*height+length*height)<<endl;
}
};
class Steladder:public Ladder,public ThreeDimShape
{
public:
Steladder(double w,double l,double d,double h):Ladder(w,l,d),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of steladder is:"<<length*length+downlen*downlen+4*(length+downlen)*width/2<<endl;
}
};
int main()
{
Shape *s[6];
s[0]=new Circle(4);
s[1]=new Rectangle(1,2);
s[2]=new Ladder(3,4,5);
s[3]=new Cylirder(4,8);
s[4]=new Cube(5,5,5);
s[5]=new Steladder(6,8,10,10);
for(int i=0;i<6;i++)
{
s[i]->Area();
}
delete[]*s;
return 0;
}
#include<cmath>
using namespace std;
const double PI=3.14;
class Shape
{
public:
virtual void Area()=0;
virtual ~Shape(){}
};
class TwoDimShape:virtual public Shape
{};
class ThreeDimShape:virtual public Shape
{
protected:
double height;
public:
ThreeDimShape(double h){height=h;}
};
class Circle:public TwoDimShape
{
protected:
double radius;
public:
Circle(double r)
{
radius=r;
}
void Area()
{
cout<<"Area of circle is:"<<PI*radius*radius<<endl;
}
};
class Rectangle:public TwoDimShape
{
protected:
double width,length;
public:
Rectangle(double w,double l)
{
width=w;
length=l;
}
void Area()
{
cout<<"Area of rectangle is:"<<width*length<<endl;
}
};
class Ladder:public Rectangle
{
protected:
double downlen;
public:
Ladder(double w,double l,double d):Rectangle(w,l)
{
downlen=d;
}
void Area()
{
cout<<"Area of ladder is:"<<(length+downlen)*width/2<<endl;}
};
class Cylirder:public ThreeDimShape,public Circle
{
public:
Cylirder(double r,double h):Circle(r),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of cylirder is:"<<2*PI*radius*height+2*PI*radius*radius<<endl;
}
};
class Cube:public ThreeDimShape,public Rectangle //正方体
{
public:
Cube(double w,double l,double h):Rectangle(w,l),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of cube is:"<<2*(width*length+width*height+length*height)<<endl;
}
};
class Steladder:public Ladder,public ThreeDimShape
{
public:
Steladder(double w,double l,double d,double h):Ladder(w,l,d),ThreeDimShape(h)
{}
void Area()
{
cout<<"Area of steladder is:"<<length*length+downlen*downlen+4*(length+downlen)*width/2<<endl;
}
};
int main()
{
Shape *s[6];
s[0]=new Circle(4);
s[1]=new Rectangle(1,2);
s[2]=new Ladder(3,4,5);
s[3]=new Cylirder(4,8);
s[4]=new Cube(5,5,5);
s[5]=new Steladder(6,8,10,10);
for(int i=0;i<6;i++)
{
s[i]->Area();
}
delete[]*s;
return 0;
}
追问
我不是初学者。。谢谢。。。不要拿这些练习给我好么。。。我要的是实用的程序啊。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一些SDK包中有sample或demo,其中有实例程序,而且这些程序都很成熟。
比如开源图形库wykobi,比如ObjectARX
比如开源图形库wykobi,比如ObjectARX
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
去csdn上面下吧,多得很
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询