首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C++
C++综合大作业题目
1.对复数运算符重载
定义一个复数类,Complex,重载运算符“+”、“-”、”*”、“/”,使之能够用于两个复数、一个复数与一个实数的加、减、乘、除运算。重载运算符函数使用Complex成员函数和友元函数两种形式实现。
2.矩阵运算
设有两个3行3列矩阵A、B,求两矩阵的和、差、乘。
A+B=(aij+bij)
A- B=(aij-bij)
3.简单职工工资管理统计
编程实现如下功能:
(1) 按职工号由大到小的顺序通过键盘输入10个职工的数据(包括职工号、姓名、年龄、工资)并输出到磁盘文件zggz1.dat(二级制文件)保存。
(2) 从键盘输入若干个职工数据(职工号要大于已存在的职工号)追加到磁盘文件zggz1.dat的末尾。
(3) 从键盘输入一个职工号,从磁盘文件zggz1.dat中有无该职工号,如存在,则显示该职工是第几个职工,并显示该职工的信息;如果没有,则显示信息“查无此人”。
......................
阅读全部 | 重载 贴于 2015年6月11日 17:32     hide bbsi
#include<iostream>
using namespace std;
const double Pi=3.14;
class ball
{protected:
int r;
public:
voidsetdata()
   {
cout<<"please enter the r:"<<endl;
cin>>r;
   }
......................
阅读全部 | Orphan 贴于 2015年5月29日 20:51     hide bbsi
#include<iostream>
using namespace std;
int add(int,int);
double add(double,double);
void main()
{
  cout<<add(2,4)<<endl;//doulie型 只有当小数点后不为0时,计算结果才会显示出小数的形式。
  cout<<add(2.0,4.7)<<endl;//进行函数重载的时候,要求同名函数的参数个数或参数类型不同。否则将无法重载。
}
int add(int x,int y)
{
   return(x+y);
......................
阅读全部 | 天章 贴于 2015年5月25日 21:46     hide bbsi
class Point{
private:
double x, y;
public:
Point(){x=0;y=0;}
Point(double xv, double yv){x=xv; y=yv;}
Point(Point&pt){x=pt.x;y=pt.y;}
double getx(){return x;}
double gety(){return y;}
double Area(){return 0;}
void Show(){cout << "x=" << x << " "<<"y="<<y<<endl;}
};
......................
阅读全部 | chen初阳 贴于 2015年5月19日 08:48     hide bbsi
include<iostream>
#include<stdio.h>
int main() 
{ int a,b,c,s1=0,s2=0,s3=0,i,j,k;
  cin>>a>>b>>c;
for(i=1;i<=a;i++)
s1=s1+i;
cout<<s1<<endl;
for(j=1;j<=b;j++)
s2=s2+j*j;
cout<<s2<<endl;
for(k=1;k<=c;k++)
......................
阅读全部 | 沉迷 贴于 2015年5月12日 21:11     hide bbsi
#ifndef VECTOR_H
#define VECTOR_H
#include <iostream>
using namespace std;
class Vector{
int length ;
int *arr;
public:
 Vector(int len);
~ Vector();
void Print();
void Add(int value);
......................
阅读全部 | 冷热sx 贴于 2015年5月8日 20:25     hide bbsi
#include<iostream>
using namespace std;
void g(int n)
{
cout<<"开始:n="<<n<<endl;
if(n==0)
return;

g(n/2);
cout<<"结束:n="<<n<<endl;
}
int main()
......................
阅读全部 | 尚志留恋 贴于 2015年4月24日 16:58     hide bbsi
#include <iostream>
using namespace std;
class date{
public:
date();
date(int y,int m, int d);
~date();
date(date &d);
void settime(int y,int m,int d);
void showtime();
private:
int year;
......................
阅读全部 | Konglinghui 贴于 2015年4月24日 00:08     hide bbsi
#include<math.h>
#include<stdio.h>
main() 
{
double s,h,p,p1,p0,a,v,w,p2;
w=215*3.14/30,h=30,p0=90,p1=90,p=0,p2=190;
for(p=0;p<=190;p=p+5)
{if(0<=p&&p<=45)
{s=2*h*p*p/p0*p0,v=4*h*w*p/p0*p0,a=4*h*w*w/p0*p0;}
else
{if(45<p&&p<=90)
s=(h-2*h*(p0-p)*(p0-p))/p0*p0,v=4*h*w*(p0-p)/p0*p0,a=-4*h*w*w/p0*p0;}
......................
阅读全部 | liu609 贴于 2015年4月19日 19:39     hide bbsi
1>d:\2008\源程序文件\traffic\traffic\trafficview.cpp(170) : error C3861: “KillerTimer”: 找不到标识符
我在 编译一个交通灯求解决法案?
阅读全部 | 拖帝 贴于 2015年4月17日 10:32     hide bbsi
上一页 23 24 25 26 27 28 29 30 31 32 下一页