- 博客(0)
- 资源 (5)
- 收藏
- 关注
C++管理系统
#include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct stud //学生信息结构 { long num; char name[20]; float score; }Stud; typedef struct node { Stud student; struct node *next; }Node; Node *head=NULL; void read(void); void inser(long b); void print(); void find(long b); void searchname(char *s); Node * del(long n); void sort(int flag); void menu(); void main() { char choose; int flag=1; while (flag) { menu(); //调用功能菜单函数,显示菜单项。 printf(" 请选择:"); choose=getchar();
2013-06-12
酒店管理系统20130529
Base.Dlg.cpp
程序
:
#include "stdafx.h"
#include "MyPos.h"
#include "BaseDlg.h"
#include "MaterielDlg.h"
#include "ClassDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBaseDlg dialog
CBaseDlg::CBaseDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBaseDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBaseDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CBaseDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBaseDlg)
DDX_Control(pDX, IDC_TAB_BASE, m_oTabBase);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)
//{{AFX_MSG_MAP(CBaseDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBaseDlg message handlers
BOOL CBaseDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_oTabBase.AddPage("
商品类别
", &m_oClassdlg, IDD_DIALOG_CLASS);
m_oTabBase.AddPage("
商品资料
", &m_oMaterieldlg, IDD_DIALOG_MA
TERIEL);
m_oTabBase.AddPage("
付款方式
", &m_oPaymodedlg, IDD_DIALOG_PAYMODE);
m_oTabBase.Show();
return TRUE;
// return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CallDlg.cpp
程序:
#include "stdafx.h"
#include "MyPos.h"
#include "CallDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCallDlg dialog
extern CMyPosApp theApp;
CCallDlg::CCallDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCallDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCallDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CCallDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCallDlg)
DDX_Control(pDX, IDC_STATIC_CALL, m_oCallstatic);
DDX_Control(pDX, IDC_EDIT_CALLBILLID, m_oCallbillid);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCallDlg, CDialog)
//{{AFX_MSG_MAP(CCallDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCallDlg message handlers
void CCallDlg::OnOK()
{
if(dowhat=="imhappy")
{
theApp.scallid="";
m_oCallbillid.GetWindowText(theApp.scallid);
}
if(dowhat=="pleased")
m_oCallbillid.GetWindowText(dowhat);
CDialog::OnOK();
}
BOOL CCallDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(dowhat=="pleased")
m_oCallstatic.SetWindowText("
请输入桌号:
");
return TRUE;
// return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
CheckDlg.cpp
程序:
#include "stdafx.h"
#include "MyPos.h"
#include "CheckDlg.h"
#include "PosDlg.h"
2013-05-30
数据结构,冒泡算法演示
JAVA 演示冒泡算法 内有动画演示
问题
有一数组a,长度为n,把数组中的元素从小到大重新排列
思路
从0到n-1,两两比较数组中的元素,如果前者大于后者,则交换之(如a[0]>a[1],则交换a[0]和a[1])。作一趟冒泡排序后,最大值就在最后一个位置a[n-1]上了。然后对余下的0到n-2个元素作第二趟冒泡排序,次最大值就去到倒数第二个位置a[n-2]上了,如此类推。
例如对10,-3,5,34,-34,5,0,9进行排序
第一趟:-3,5,10,-34,5,0,9,34
第二趟:-3,5,-34,5,0,9,10,34
第三趟:-3,-34,5,5,0,9,10,34
第四趟:-34,-3,5,0,5,9,10,34
第五趟:-34,-3,0,5,5,9,10,34
这时不再发生交换,排序结束。
核心代码:
static void sort(int[] array) {
int length = array.length;
int temp;
boolean isSort;
for(int i = 1; i < length; i++) {
isSort = false;
for(int j = 0; j < length - i; j++) {
if(array[j] > array[j+1]) {
//交换
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
isSort = true;
}
}
if(!isSort) break; //如果没有发生交换,则退出循环
}
}
全部代码:
package com.icescut.classic.algorithm;
public class BubbleSort {
public static void main(String[] args) {
int[] array = {10,-3,5,34,-34,5,0,9}; //test data
sort(array);
for(int el : array) {
System.out.print(el + " ");
}
}
static void sort(int[] array) {
int length = array.length;
int temp;
boolean isSort;
for(int i = 1; i < length; i++) {
isSort = false;
for(int j = 0; j < length - i; j++) {
if(array[j] > array[j+1]) {
//交换
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
isSort = true;
}
}
if(!isSort) break; //如果没有发生交换,则退出循环
}
}
}
2013-05-29
学生成绩管理
#include<stdio.h>#include<malloc.h>#include<string.h>#include<stdlib.h>#define NULL 0#define LEN sizeof(struct student)struct student{ int num; char name[10]; int score; struct student *next;};int n;struct student *creat(){ struct student *head; struct student *p1,*p2; p1=p2=(struct student *)malloc(LEN); printf("请输入数据:\n"); printf("-学号---姓名---成绩-\n"); scanf("%d%s%d",&p1->num,p1->name,&p1->score); head=NULL; n=0; while(p1->num!=NULL) { n=n+1; if(n==1) head=p1; else p2->next=p1; p2=p1;
2013-05-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人