- 博客(23)
- 收藏
- 关注
原创 用程序输出一个小房子的程序
public class House { static void top() //top是输出上边的三角部分 { for(int a=1;a for(int b=1;b System.out.print(" "); for(int c=1;c if(c==1||c==2*a-1)
2012-04-18 16:34:14 488
原创 GUI程序设计
import java.awt.*;public class Test{ public static void main(String[] args){ Frame f=new Frame("登陆界面"); f.setBackground(Color.blue); f.setLayout(new FlowLayout()); Label c1=new Label("
2012-04-18 16:21:54 308
原创 GUI程序设计
import java.awt.*;public class Test{ public static void main(String[] args){ Frame f=new Frame("登陆界面"); f.setBackground(Color.blue); f.setLayout(new FlowLayout()); Label c1=new Label("
2012-04-18 16:21:23 211
原创 java
class rect{ private double length=15.5; private double width=10.6; double zhouchang() { return (length+width)*2; } double area() { return length*width; }}
2012-03-07 15:49:23 220
原创 新学期新体验
新学期又增加了许多课程,开学的第一周感觉很累,尤其是CSDN的同学,我学的是对日,对于我来说这门课是一个全新的认识,我相信我会学好的,鼓励自己!!!!!!!
2012-02-22 13:59:14 1043
原创 计算函数F(x,y,z)=(x+y)/(x-y)+(z+y)/(z-y)的值
#include float fun(float,float);void main(){ float x,y,z, sum=0 ; cout cin>>x>>y>>z; sum=fun(x,y)/fun(x,-y)+fun(z,y)/fun(z,-y) ; cout}float fun(float a,float b){ float value
2011-12-21 11:36:52 4295
原创 例题
#include class data { int x;public: data (int x) //定义构造函数 { x =x; //为数据成员赋值 }};class a{ data d1;public: a(int x):d1(x) {
2011-12-21 11:33:33 237
原创 斐波那契数列前20项
#include"iostream.h"void fibonacci();void main(){ fibonacci();}void fibonacci(){ int i,f[10]; f[0]=1; f[1]=1; for(i=2;i { f[i]=f[i-1]+f[i-2]; } for(i=0;i { cout }
2011-12-21 10:35:26 1930
原创 使用虚基数消除多重继承中的二义性
#include"iostream.h"class A{public: int x;};class B:virtual public A{public: int y;};class C:virtual public A{public: int z;};class D:public B,public C{public: in
2011-12-07 10:41:58 658
原创 心情
考完CSDN了,我才觉得我有很多不会的地方,C++学的还是不怎么牢固,呜呜……程序看上去会了,可是让我自己写却写的不完善,我要努力了!!!!!!!!!
2011-12-06 17:17:35 168
原创 派生类的构造函数例题
//派生类的构造函数//派生类名(派生类构造函数参数表):基类构造函数(参数表),子对象构造函数(参数表)//{ //派生类中新增成员初始化//}//调用顺序://1调用基类中的够造函数 2存在子对象,调用子对象的构造函数 3 调用派生类的构造函数 #include"iostream.h"//基类class A{private: int x;
2011-12-06 17:12:42 597
原创 公有继承应用实例
#include"iostream.h"//基类class Base{private: int a;protected: int b;public: void setB(int x, int y) { a=x; b=y; } void dispB() { cout }};//派生类class Derived:pu
2011-12-06 16:48:28 329
原创 重载为类的友元函数
#include"iostream.h"class complex{private: double real; double imag;public: complex(){} 定义构造函数; complex(double r,double i)
2011-11-30 11:04:28 466
原创 运算符的重载
#include"iostream.h"class complex{private: double real; double imag;public: complex(){} complex(double r,double i) { real=r; imag=i; } void display() { cout
2011-11-30 10:56:15 179
原创 构造函数重载
#include"iostream.h"class date{private: int year; int month; int day;public: date() { year=2000; month=1;day=1; cout } date(int d) { year=2000; month=1;day=d; co
2011-11-29 17:02:57 228
原创 函数的多态性—重载函数
#include"iostream.h"class A{public: int twofold(int a) { int i; i=2*a; cout return i; } double twoflod(double a) { double i; i=2*a; cout return i; }};void
2011-11-29 16:40:51 344
翻译 指针指向功能
#include"iostream.h"void main(){ char *s="hello!!"; 指针S指向常量字符串hello!!; char *p=s; 指针p指向常量字符串hello!!; 指针的指针 char **pp; 指针PP的地址和指针函数S的地
2011-11-23 11:32:36 328
原创 字符串赋值功能在程序
#include"iostream.h"void strcpy(){ while(*s!="10"){*d=*s;s++;d++;}}void main(){char a[]="hello!";char b[]="nihao!!";strcpy(b,a)coutcout}
2011-11-23 11:06:15 316
原创 求和求平均数
#include"iostream.h"int a[2][4];int sum[2];double avg[4];void main(){int i,j; for(i=0;i { cout for(j=0;j cin>>a[i][j];}for(i=0;i{ sum[i]=0; for(j=0;j}for(j=0
2011-11-21 11:43:13 450
原创 程序1
###有一个分数序列:2/1,3/2,5/3,8/5,13/8,21/13,………………求出该数的前二十项之和!!!!! void main(){ int fz,fm; int i, t; float sum=0; for(i=0;i { sum=sum+(fm/fz); t=fz; fz=fz+fm; fm=t; } cout
2011-11-14 10:16:25 181
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人