自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (12)
  • 收藏
  • 关注

原创 司机与售票员的代码

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ProcComu{    public partial cl

2010-05-31 10:50:00 1407

经典的SQL语句大全供大家参考

经典的SQL语句大全供大家参考

2011-12-06

Svn的使用说明SVN+APACHE整合使用手册

SVN 是一个版本控制工具,Subversion 的版本库(repository),就是位于服务器端,统 一管理和储存数据的地方。 要创建一个版本库,首先要确定采用哪种数据存储方式。在Subversion 中,版本库的 数据存储有两种方式,一种是在Berkeley DB 数据库中存放数据;另一种是使用普通文件, 采用自定义的格式来储存,称为FSFS。

2011-09-01

网店系统的前台和后台

1.前台 前台主要实现了购买商品和查看商品信息的功能。在购买商品前需要先进行登录,如果您还未注册会员,需要先进行注册。注册成功后进行登录,登录成功后用户即可购买商品,具体的购买操作步骤如下: (1)登录成功后,单击“购买”按钮,弹出“恭喜您,添加成功!”提示信息,将该商品添加到购物车中。 (2)商品购买完成后,单击“购物车”按钮,进入购物车页面,如图1.8所示。在此页面中可以修改商品数量、继续购买商品、删除当前购买的商品及清空购物车的功能。 (3)购买商品确定后,单击“结账”按钮,进入结账页面,如图1.9所示。填写正确的收货信息后,单击“保存”按钮,完成购买操作。 (3)购买商品确定后,单击“结账”按钮,进入结账页面,如图1.9所示。填写正确的收货信息后,单击“保存”按钮,完成购买操作。

2011-06-07

MVC编程所写的增删改例题

最新的MVC3.0所写的增删改查例题,简单的例题学习,提供给刚接触到MVC的朋友们!作为简单的应用例题!

2011-03-22

比较完整的网上论坛,使用的是C#写的ASP.Net网页编写的

比较完整的网上论坛,使用的是C#写的ASP.Net网页编写的,这是花了一个多月的时间写的,做为大家的参考吧!

2011-03-01

完整的音乐闹钟用C#写的比较完整的系统,很简单的!

用C#写的比较完整的音乐闹铃,欢迎使用。

2011-02-28

asp.net的网页购物车

用ASP。NET做得购物车 有易于初学者的学习!作为参考吧!

2010-07-01

二叉树的遍历c#的控制台写得

我用的是c#控制台写得二叉树 可以实现的二叉树

2010-05-20

ASP.NET的业务层类库

ASP.NET的业务层类库 用得是VS2008写得,代码较全!

2010-05-11

查找子字符串 用得是c#窗体写得

查找子字符串 用得是c#窗体写得 里面带有两种方法 并且是用VS2008 写得,需要的话支持一下!!

2010-05-11

C++多项式的和为你们提供的也为自己提供

#include<stdio.h> #include<malloc.h> #include<stdlib.h> typedef struct polynode { int coef; //多项式的系数 int exp; //指数 struct polynode *next; }node; node *create() //用尾插法建立一元多项式的链表 { node *h,*r,*s; int c,e; h=(node*)malloc(sizeof(node)); r=h; printf("coef:"); scanf("%d",&c); printf("exp: "); scanf("%d",&e); while(c!=0) //输入系数为0时,多项式的输入结束 { s=(node*)malloc(sizeof(node)); s->coef=c; s->exp=e; r->next=s; r=s; printf("coef:"); scanf("%d",&c); printf("exp: "); scanf("%d",&e); } r->next=NULL; return(h); } void print(node *p) //输出函数,打印出一元多项式 { while(p->next!=NULL) { p=p->next; printf(" %d*x^%d",p->coef,p->exp); } } void polyadd(node *ha, node *hb)//一元多项式相加函数,用于将两个多项式相加,然后将和多项式存放在多项式ha中,并将多项式hb删除 { node *p,*q,*pre,*temp; int sum; p=ha->next; q=hb->next; pre=ha; while(p!=NULL&&q!=NULL) { if(p->exp<q->exp) { pre->next=p; pre=pre->next; p=p->next; } else if(p->exp==q->exp) { sum=p->coef+q->coef; if(sum!=0) { p->coef=sum; pre->next=p;pre=pre->next;p=p->next; temp=q;q=q->next;free(temp); } else //如果系数和为零,则删除结点p与q,并将指针指向下一个结点 { temp=p->next;free(p);p=temp; temp=q->next;free(q);q=temp; } } else { pre->next=q; pre=pre->next; q=q->next; } } if(p!=NULL) //将多项式A中剩余的结点加入到和多项式中 pre->next=p; else pre->next=q; } void multipoly(node *ha,node *hb) { node *p,*q,*n,*m; p=ha->next; n=(node*)malloc(sizeof(node)); n->next=NULL; while(p!=NULL) { m=(node*)malloc(sizeof(node)); for(q=hb->next;q;q=q->next) { m->coef=p->coef*q->coef; m->exp=p->exp+q->exp; m->next=NULL; } p=p->next; polyadd(n,m); } printf("多项式的积是:\n"); print(n); } void main() { node *ha,*hb; printf("请输入多项式ha的系数与指数:\n"); ha=create(); print(ha); printf("\n"); printf("请输入多项式hb的系数与指数:\n"); hb=create(); print(hb); printf("\n"); printf("多项式的和是:\n"); polyadd(ha,hb); print(ha); printf("\n"); multipoly(ha,hb); }

2010-04-22

C#100例题 献给c#初学者

给初学者的简单例题! private System.ComponentModel.IContainer components; private const int kNumberOfRows = 8; private const int kNumberOfTries = 3; private int NumTotalBricks = 0; private int NumBalls = 0; private Ball TheBall = new Ball(); private Paddle ThePaddle = new Paddle(); private System.Windows.Forms.Timer timer1; private Row[] Rows = new Row[kNumberOfRows]; private Score TheScore = null; private Thread oThread = null; [DllImport("winmm.dll")] public static extern long PlaySound(String lpszName, long hModule, long dwFlags); public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); for (int i = 0; i < kNumberOfRows; i++) { Rows[i] = new Row(i); } ThePaddle.Position.X = 5; ThePaddle.Position.Y = this.ClientRectangle.Bottom - ThePaddle.Height; TheBall.Position.Y = this.ClientRectangle.Bottom - 200; this.SetBounds(this.Left, this.Top, Rows[0].GetBounds().Width, this.Height); TheScore = new Score(ClientRectangle.Right - 50, ClientRectangle.Bottom - 180); // choose Level SpeedDialog dlg = new SpeedDialog(); if (dlg.ShowDialog() == DialogResult.OK) { timer1.Interval = dlg.Speed; } // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } private string m_strCurrentSoundFile = "BallOut.wav"; public void PlayASound() { if (m_strCurrentSoundFile.Length > 0) { PlaySound(Application.StartupPath + "\\" + m_strCurrentSoundFile, 0, 0); } m_strCurrentSoundFile = ""; oThread.Abort(); } public void PlaySoundInThread(string wavefile) { m_strCurrentSoundFile = wavefile; oThread = new Thread(new ThreadStart(PlayASound)); oThread.Start(); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.timer1 = new System.Windows.Forms.Timer(this.components); // // timer1 // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(552, 389); this.KeyPreview = true; this.Name = "Form1"; this.Text = "Brick Out"; this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; g.FillRectangle(Brushes.White, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height); TheScore.Draw(g); ThePaddle.Draw(g); DrawRows(g); TheBall.Draw(g); } private void DrawRows(Graphics g) { for (int i = 0; i < kNumberOfRows; i++) { Rows[i].Draw(g); } } private void CheckForCollision() { if (TheBall.Position.X < 0) // hit the left side, switch polarity { TheBall.XStep *= -1; TheBall.Position.X += TheBall.XStep; PlaySoundInThread("WallHit.wav"); } if (TheBall.Position.Y this.ClientRectangle.Right - TheBall.Width ) // hit the left side, switch polarity { TheBall.XStep *= -1; TheBall.Position.X += TheBall.XStep; PlaySoundInThread("WallHit.wav"); } if (TheBall.Position.Y > this.ClientRectangle.Bottom - TheBall.YStep) // lost the ball! { IncrementGameBalls(); Reset(); PlaySoundInThread("BallOut.wav"); } if (RowsCollide(TheBall.Position)) { TheBall.YStep *= -1; PlaySoundInThread("BrickHit.wav"); } int hp = HitsPaddle(TheBall.Position); if (hp > -1)// lost the ball! { PlaySoundInThread("PaddleHit.wav"); switch (hp) { case 1: TheBall.XStep = -7; TheBall.YStep = -3; break; case 2: TheBall.XStep = -5; TheBall.YStep = -5; break; case 3: TheBall.XStep = 5; TheBall.YStep = -5; break; default: TheBall.XStep = 7; TheBall.YStep = -3; break; } } } private int HitsPaddle(Point p) { Rectangle PaddleRect = ThePaddle.GetBounds(); if (p.Y >= this.ClientRectangle.Bottom - (PaddleRect.Height + TheBall.Height) ) { if ((p.X > PaddleRect.Left) && (p.X PaddleRect.Left) && (p.X PaddleRect.Left + PaddleRect.Width/4) && (p.X PaddleRect.Left + PaddleRect.Width/2) && (p.X = kNumberOfTries) { timer1.Stop(); string msg = "Game Over\nYou knocked out " + NumTotalBricks; if (NumTotalBricks == 1) msg += " brick."; else msg += " bricks."; MessageBox.Show(msg); Application.Exit(); } } private void Reset() { TheBall.XStep = 5; TheBall.YStep = 5; TheBall.Position.Y = this.ClientRectangle.Bottom - 190; TheBall.Position.X = 5; timer1.Stop(); TheBall.UpdateBounds(); Invalidate(TheBall.GetBounds()); } private int SumBricks () { int sum = 0; for (int i = 0; i < kNumberOfRows; i++) { sum += Rows[i].BrickOut; } return sum; } private bool RowsCollide (Point p) { for (int i = 0; i < kNumberOfRows; i++) { if (Rows[i].Collides(TheBall.GetBounds())) { Rectangle rRow = Rows[i].GetBounds(); Invalidate(rRow); return true; } } return false; } private void timer1_Tick(object sender, System.EventArgs e) { TheBall.UpdateBounds(); Invalidate(TheBall.GetBounds()); TheBall.Move(); TheBall.UpdateBounds(); Invalidate(TheBall.GetBounds()); CheckForCollision(); NumTotalBricks = SumBricks(); TheScore.Count = NumTotalBricks; Invalidate(TheScore.GetFrame()); if (NumTotalBricks == kNumberOfRows*Row.kNumberOfBricks) { timer1.Stop(); MessageBox.Show("You Win! You knocked out all the bricks!"); Application.Exit(); } } private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { string result = e.KeyData.ToString(); Invalidate(ThePaddle.GetBounds()); switch (result) { case "Left": ThePaddle.MoveLeft(); Invalidate(ThePaddle.GetBounds()); if (timer1.Enabled == false) timer1.Start(); break; case "Right": ThePaddle.MoveRight(ClientRectangle.Right); Invalidate(ThePaddle.GetBounds()); if (timer1.Enabled == false) timer1.Start(); break; default: break; } }

2010-04-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除