- 博客(19)
- 收藏
- 关注
原创 求素数,奇数,偶数和
/*程序的版权和版本声明部分: *Copyright(c)2014,烟台大学计算机学院学生 *All rights reserved. *文件名称: *作者: *完成日期:2014 年 6 月 14 日 *版本号:v1.0 *对任务及求解方法的描述部分: *问题描述:求一个数内的所有素数,奇数,偶数和 *程序输入:一个数 *程序输出:
2014-09-30 08:21:08 688
原创 用二进制处理学生成绩
#include #include#include#includeusing namespace std;//(一)定义学生类class Student{public: Student(){}; Student(int n, string nam, double c, double m, double e):num(n),name(nam),cpp(c)
2014-09-02 09:15:20 708
原创 立体族类共有的抽象类
#include "iostream"using namespace std;const double pai=3.1415926;// 抽象立体图形基类class CSolid{public: virtual double SurfaceArea() const=0; virtual double Volume() const=0;};// 立方体
2014-09-02 09:07:05 436
原创 动物如何叫
#include "iostream"#includeusing namespace std;class Animal{public: virtual void cry() { cout<<"不知哪种动物,让我如何学叫?"<<endl; }};class Mouse : public Animal{privat
2014-09-02 08:35:17 965
原创 与圆心相连的直线
#include #includeusing namespace std;class Circle; //由于在Point中声明友元函数crossover_point中参数中用了Circle,需要提前声明class Point{public: Point(double a=0,double b=0):x(a),y(b) {} //构造函数 frien
2014-09-02 08:31:15 634
原创 圆的比较
#include #includeusing namespace std;class Point{public: Point(double a=0,double b=0):x(a),y(b) {} //构造函数protected: //受保护成员 double x,y;};class Circle:public Poin
2014-09-02 08:28:32 972
原创 日期时间类
#includeusing namespace std;class Date{public: void SetDate(int y,int m,int d) { Year=y; Month=m; Day=d; } void PrintDate() { cout<
2014-09-02 08:24:36 562
原创 存储班长信息的学生类
#include #include using namespace std;class Stu //声明基类{public: Stu(int n, string nam ); //基类构造函数 void display( ); //成员函数,输出基类数据成员private: //访问权限为保护型的数据成员
2014-09-02 08:16:20 471
原创 动态数组的应用
#include#includeint main(){ int number; //学生人数 int *score; //动态数组的首地址 int sum=0,ave; //成绩和 int i; //输入学生人数,为动态数组score分配合适大小的空间 printf("输入学生人数: ");
2014-09-01 20:45:23 464
原创 练习4
#include#includeint main(){ int count, i,j,r; float *pf, tmp; scanf("%d", &count); //输入班级人数 //分配空间,用动态数组存储全班同学成绩 pf = (float*) malloc( sizeof(float) * count ); //
2014-09-01 20:39:24 558 2
原创 练习3
#include #include #define NUM 50#define SPEED 50.0#define UP 1.0#define DOWN 0.5struct Point{ float x, y;};struct Roof{ struct Point loc; //屋顶的位置 int p;
2014-09-01 20:27:49 435
原创 练习2
#include #define N 5struct Student{ int num; //学号 int c; //C语言成绩,学分为3 int law; //法律成绩,学分为4 float aver; //平均学分绩(各科成绩乘以学分的和,再除以总学分)};int main( ){ int i; //freo
2014-09-01 20:27:25 565
原创 输入学号查成绩
#include int main(){ int n[110],s[110]; //分别保存学号和成绩 int i,k,count=0; freopen("score1.txt","r",stdin); //输入重定向,数据将从文件中读入 //读入数据 while(scanf("%d%d",&n[count],&s[count])!=E
2014-09-01 19:57:38 7183
原创 看看今天是今年的第几天
#include int main( ){ int y,m,d; //a[1]-a[12]中保存了1-12月的天数,a[0]没有用 int a[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31}; int sum=0; int i; printf("请输入年月日:"); scanf(
2014-09-01 19:44:20 1701
原创 练习1
下面的程序,输出了52张扑克牌(如图),请补充完整程序。 #include int main( ){ char c[4]= {'H','S','D','C'}; int v[13]= {1,2,3,4,5,6,7,8,9,10,11,12,13}; int i,j; for(i=0; i for(j=0; j
2014-09-01 19:39:56 531
原创 污损的等式
一名数学家离奇失踪!在他的住所,侦察人员发现了一张纸上有一个等式被故意污损。难道的他的失踪与此相关?我们需要先还原了这个等式。等式是:其中■处为1个数字,滴上了墨水无法辨认。请编程找出■表示哪个数字。
2014-09-01 19:35:51 528
原创 股市风云
股市强烈动荡,有涨有跌。现在有一组数据,共30个,表示30个公司的涨跌(涨为正,跌为负,持平为零)情况,请编程序,统计出平均涨幅(正数的平均数)和平均跌幅(负数的平均数,再取反)。 #include "stdio.h"int main(){ int i,c_inc=0, c_dec=0; //涨的个数和跌的个数 float v, s_inc=0, s_dec=0
2014-09-01 19:25:25 612
原创 要减肥吗?
女性的标准体重是:身高(厘米)-100= 标准体重(公斤),超过标准体重20%以上者为肥胖,低于标准体重20%的为偏瘦,在肥胖与偏瘦之间为正常。请编一个为女孩子们评价自己体重情况的程序,输入身高(cm)与体重(kg)的值,输出评价价结果:肥胖时输出high,正常时输出normal,偏瘦要输出low。
2014-09-01 19:15:27 500
原创 daigai
#include using namespace std;class Rectangle //矩形类{private:int length; //矩形的长和宽int width;public:Rectangle();Rectangle(int l,int w); //构造函数,l、w分别代表长和宽int getArea(); //求面积};class
2014-09-01 13:31:33 673
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人