
正文
饭卡管理系统java代码 饭卡管理系统java代码怎么写
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
紧急求助有关JAVA编程问题,编出给高分
楼上说的对啊,时间问题,祝你好运啦!
PS:楼主不是我说你,这事早干嘛了~~
相关问答
Q1: 求java实现的饭卡管理系统能连接数据库使用
答案voidmain(){intsele=1,t;floatx;system("cls");printf("欢迎使用简易菜单!本菜单在VC++平台编译通过\n");printf("有何建议请联系本人!\n");printf("成绩管理菜单\n");printf("\n");printf("1.输入成绩2.计算总分3.求平均值4.输出总分与平均5.清理屏幕6.高低排列7.上平均分人数0.退出8.全部情况:总分平均分第一名及格人数");scanf("%d",sele);puts("");if(sele=0sele1.输入成绩2.计算总分3.求平均值4.输出总分与平均5.清理屏幕6.高低排列7.上平均分人数0.退出8.全部情况:总分平均分第一名及格人数\n");break;case6:gaodi(a);break;case7:super(a);break;case8:full(t,x);break;}elseprintf("你的输入有误,请重新:")
Q2: JAVA 这个东西怎么做?
package javaapplication26;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
// Import the Java classes
import java.util.*;
import javax.swing.border.EmptyBorder;
/**
* A JOutlookBar provides a component that is similar to a JTabbedPane, but instead of maintaining
* tabs, it uses Outlook-style bars to control the visible component
*/
public class JOutlookBar extends JPanel implements ActionListener {
private JPanel topPanel = new JPanel(new GridLayout(1, 1));
private JPanel bottomPanel = new JPanel(new GridLayout(1, 1));
/**
* A LinkedHashMap of bars: we use a linked hash map to preserve the order of the bars
*/
private Map bars = new LinkedHashMap();
/**
* The currently visible bar (zero-based index)
*/
private int visibleBar = 0;
/**
* A place-holder for the currently visible component
*/
private JComponent visibleComponent = null;
/**
* Creates a new JOutlookBar; after which you should make repeated calls to
* addBar() for each bar
*/
public JOutlookBar() {
this.setLayout(new BorderLayout());
this.add(topPanel, BorderLayout.NORTH);
this.add(bottomPanel, BorderLayout.SOUTH);
}
public void addBar(String name, JComponent component) {
BarInfo barInfo = new BarInfo(name, component);
barInfo.getButton().addActionListener(this);
this.bars.put(name, barInfo);
render();
}
/**
* Adds the specified component to the JOutlookBar and sets the bar's name
*
* @param name The name of the outlook bar
* @param icon An icon to display in the outlook bar
* @param componenet The component to add to the bar
*/
public void addBar(String name, Icon icon, JComponent component) {
BarInfo barInfo = new BarInfo(name, icon, component);
barInfo.getButton().addActionListener(this);
this.bars.put(name, barInfo);
render();
}
/**
* Removes the specified bar from the JOutlookBar
*
* @param name The name of the bar to remove
*/
public void removeBar(String name) {
this.bars.remove(name);
render();
}
/**
* Returns the index of the currently visible bar (zero-based)
*
* @return The index of the currently visible bar
*/
public int getVisibleBar() {
return this.visibleBar;
}
/**
* Programmatically sets the currently visible bar; the visible bar
* index must be in the range of 0 to size() - 1
*
* @param visibleBar The zero-based index of the component to make visible
*/
public void setVisibleBar(int visibleBar) {
if (visibleBar 0
visibleBar this.bars.size() - 1) {
this.visibleBar = visibleBar;
render();
}
}
/**
* Causes the outlook bar component to rebuild itself; this means that
* it rebuilds the top and bottom panels of bars as well as making the
* currently selected bar's panel visible
*/
public void render() {
// Compute how many bars we are going to have where
int totalBars = this.bars.size();
int topBars = this.visibleBar + 1;
int bottomBars = totalBars - topBars;
// Get an iterator to walk through out bars with
Iterator itr = this.bars.keySet().iterator();
// Render the top bars: remove all components, reset the GridLayout to
// hold to correct number of bars, add the bars, and "validate" it to
// cause it to re-layout its components
this.topPanel.removeAll();
GridLayout topLayout = (GridLayout) this.topPanel.getLayout();
topLayout.setRows(topBars);
BarInfo barInfo = null;
for (int i = 0; i topBars; i++) {
String barName = (String) itr.next();
barInfo = (BarInfo) this.bars.get(barName);
this.topPanel.add(barInfo.getButton());
}
this.topPanel.validate();
// Render the center component: remove the current component (if there
// is one) and then put the visible component in the center of this panel
if (this.visibleComponent != null) {
this.remove(this.visibleComponent);
}
this.visibleComponent = barInfo.getComponent();
this.add(visibleComponent, BorderLayout.CENTER);
// Render the bottom bars: remove all components, reset the GridLayout to
// hold to correct number of bars, add the bars, and "validate" it to
// cause it to re-layout its components
this.bottomPanel.removeAll();
GridLayout bottomLayout = (GridLayout) this.bottomPanel.getLayout();
bottomLayout.setRows(bottomBars);
for (int i = 0; i bottomBars; i++) {
String barName = (String) itr.next();
barInfo = (BarInfo) this.bars.get(barName);
this.bottomPanel.add(barInfo.getButton());
}
this.bottomPanel.validate();
this.validate();
}
/**
* Invoked when one of our bars is selected
*/
public void actionPerformed(ActionEvent e) {
/* int currentBar = 0;
for (Iterator i = this.bars.keySet().iterator(); i.hasNext();) {
String barName = (String) i.next();
BarInfo barInfo = (BarInfo) this.bars.get(barName);
if (barInfo.getButton() == e.getSource()) {
// Found the selected button
this.visibleBar = currentBar;
render();
return;
}
currentBar++;
}*/
BarInfo barInfo = (BarInfo) this.bars.get("员工管理");
if (barInfo.getButton() == e.getSource()) {
this.visibleBar = 0;
render();
return;
}
}
/**
* Debug, dummy method
*/
public static JPanel getDummyPanel(String name) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JLabel(name, JLabel.CENTER));
return panel;
}
public static JPanel getEmployeePanel() {
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = new JPanel(gbl);
panel.setBorder(new EmptyBorder(12, 12, 0, 11));
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new addEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new modifyEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new searchEmployeeInfoAction()), gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 0, 5);
gbc.anchor = GridBagConstraints.EAST;
panel.add(new JMenuItem(new deleteEmployeeInfoAction()), gbc);
return panel;
}
/**
* Debug test...
*/
public static void main(String[] args) {
JFrame frame = new JFrame("学生信息管理");
JOutlookBar outlookBar = new JOutlookBar();
//outlookBar.addBar(TOOL_TIP_TEXT_KEY, component)
outlookBar.addBar("员工管理", getEmployeePanel());
// outlookBar.add
outlookBar.addBar("饭卡管理", getDummyPanel(""));
outlookBar.addBar("销售管理", getDummyPanel(""));
// outlookBar.addBar( "Four", getDummyPanel( "Four" ) );
// outlookBar.addBar( "Five", getDummyPanel( "Five" ) );
outlookBar.setVisibleBar(2);
frame.getContentPane().add(outlookBar);
frame.setSize(200, 400);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(d.width / 2 - 400, d.height / 2 - 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
/**
* Internal class that maintains information about individual Outlook bars;
* specifically it maintains the following information:
*
* name The name of the bar
* button The associated JButton for the bar
* component The component maintained in the Outlook bar
*/
class BarInfo {
/**
* The name of this bar
*/
private String name;
/**
* The JButton that implements the Outlook bar itself
*/
private JButton button;
/**
* The component that is the body of the Outlook bar
*/
private JComponent component;
/**
* Creates a new BarInfo
*
* @param name The name of the bar
* @param component The component that is the body of the Outlook Bar
*/
public BarInfo(String name, JComponent component) {
this.name = name;
this.component = component;
this.button = new JButton(name);
}
/**
* Creates a new BarInfo
*
* @param name The name of the bar
* @param icon JButton icon
* @param component The component that is the body of the Outlook Bar
*/
public BarInfo(String name, Icon icon, JComponent component) {
this.name = name;
this.component = component;
this.button = new JButton(name, icon);
}
public String getName() {
return this.name;
}
/**
* Sets the name of the bar
*
* @param The name of the bar
*/
public void setName(String name) {
this.name = name;
}
public JButton getButton() {
return this.button;
}
public JComponent getComponent() {
return this.component;
}
}
}
class addEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "添加员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class modifyEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "修改员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);dialog.setSize(100, 100);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class searchEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "查询员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);
//throw new UnsupportedOperationException("Not supported yet.");
}
}
class deleteEmployeeInfoAction extends AbstractAction {
{
putValue(Action.SHORT_DESCRIPTION, "heool");
putValue(Action.NAME, "删除员工信息");
putValue(Action.LONG_DESCRIPTION, "Name this element.");
putValue(Action.MNEMONIC_KEY,
new Integer(java.awt.event.KeyEvent.VK_L));
}
public void actionPerformed(ActionEvent e) {
JDialog dialog = new JDialog();
dialog.setName("Message");
dialog.setVisible(true);dialog.setVisible(true);
//点击对应的操作
//throw new UnsupportedOperationException("Not supported yet.");
}
}
程序沿用到楼上的那个模板,不过有些地方很毛糙,你自己在修改一下,比方说对事件的定义还有对那几个选项的位置等你自己再修改一下
Q3: 1用JAVA语言编写程序,实现图形化界面的学生成绩(学号,姓名,科目,成绩)管理系统。
这种东西已涉及到商业利益,没人愿意帮你吧!都想你这样别人都没钱赚啦
Q4: 急求C语言、C++ 编写的饭卡管理系统代码,最好每个版块附上一段分析,谢了
这个最好自己写,但是我有一个员工信息的代码,含注释,与这个很相似,只要稍加修改即可。
#include stdio.h
#include stdlib.h
#include windows.h //清屏函数头文件
#include string.h
struct Stuff
{
char number[10]; //员工编号
char name[10]; //员工姓名
char sex[8]; //员工性别
char borth[10]; //员工生日
char degree[20]; //员工学历
char business[20]; //员工职务
char phone[15]; //员工电话
char place[50]; //员工住址
char con[50]; //判断关键字专用
struct Stuff *next;
};
char Menu(void); //菜单显示
struct Stuff *App(struct Stuff *head); //添加
void Sort(struct Stuff *head); //排序
struct Stuff *Ser(struct Stuff *head); //查找
void Chn(struct Stuff *head,char n[10]); //更改
void Scpy(char *p,char *q); //排序中用于交换员工信息
struct Stuff *Del(struct Stuff *head,char n[10]); //删除
int Sel(char ch,struct Stuff *p,struct Stuff *q); //判断排序及关键字专用函数
void Prf(struct Stuff *head); //输出
void Fre(struct Stuff *head); //释放
int i=1; //定义全局变量,实现实时员工人数统计
int main(void)
{
char n[10];
struct Stuff *head=NULL; //链表头指针定义
while(1)
{
switch(Menu())
{
case '1':
printf("请输入员工信息,直接输入'#'结束\n");
head=App(head);
break;
case '2':
Sort(head);
break;
case '3':
head=Ser(head);
break;
case '4':
printf("员工信息如下:\n");
Prf(head);
break;
case '5':
printf("请输入员工编号:");
scanf("%s",n);
Chn(head,n);
break;
case '6':
printf("请输入员工编号:");
scanf("%s",n);
head=Del(head,n);
break;
case '0':
printf("欢迎下次光临,88!\n");
exit(0);
default:
printf("输入错误,请重新输入!\n");
}
fflush(stdin); //清楚缓冲区
printf("按任意键继续~");
getchar();
system("cls"); //清屏效果
}
Fre(head);
return 0;
}
//菜单函数
char Menu(void)
{
char ch;
printf("------------请选择-----------\n");
printf("1.添加员工信息\n2.员工信息排序\n3.查找员工信息\n4.输出员工信息\n5.更改员工信息\n6.删除员工信息\n0.退出\n-----------------------------\n");
scanf(" %c",ch);
return ch;
}
//添加成员函数
//输入参数:链表头指针
//返回参数:链表头指针
struct Stuff *App(struct Stuff *head)
{
struct Stuff *p=NULL,*q=head;
while(i)
{
p=(struct Stuff *)malloc(sizeof(struct Stuff)); //申请结构体空间
if(p==NULL)
{
printf("内存不够!\n");
exit(0);
}
p-next =NULL; //指针域为空
printf("请输入第%d名员工:\n",i);
printf(" 编号 | 姓名 | 性别 | 出生年月 | 学历 | 职务 | 电话 | 住址 :\n");
fflush(stdin);
scanf("%s",p-number );
if(!strcmp(p-number ,"#"))
{
free(p); //释放不需要的结构体内存
break;
}
else
{
++i;
scanf("%s%s%s%s%s%s%s",p-name ,p-sex ,p-borth ,p-degree ,p-business ,p-phone ,p-place );
p-con[0]='\0'; //防止后面判断出现随机值
if(head==NULL)
head=p;
else
{
while(q-next !=NULL) //防止结束后再次输入时出现问题
q=q-next ;
q-next =p;
}
q=p; //每次都加在链表尾
}
}
return head;
}
//排序函数
//输入参数:头指针
void Sort(struct Stuff *head)
{
char ch;
struct Stuff *p,*q,*r;
while(1)
{
printf("请选择排序条件:1.编号2.姓名3.性别4.出生年月5.学历6.职务7.电话8.地址0.退出\n");
scanf(" %c",ch);
if(ch=='0')
break;
if(ch'1'||ch'8')
{
printf("输入错误,请重新输入!\n");
continue;
}
p=head;
while(p-next!=NULL) //选择排序
{
q=p-next;
r=p;
while(q!=NULL)
{
if(Sel(ch,r,q)) //调用判断函数
r=q;
q=q-next;
}
if(r!=p) //交换内容
{
Scpy(r-number,p-number);
Scpy(r-name,p-name);
Scpy(r-sex,p-sex);
Scpy(r-borth,p-borth);
Scpy(r-degree,p-degree);
Scpy(r-business,p-business);
Scpy(r-phone,p-phone);
Scpy(r-place,p-place);
}
p=p-next;
}
Prf(head); //输出
}
}
//交换函数
void Scpy(char *p,char *q)
{
char c[50];
strcpy(c,p);
strcpy(p,q);
strcpy(q,c);
}
//判断函数
//输出参数:1为真,0为假
int Sel(char ch,struct Stuff *p,struct Stuff *q)
{
switch(ch) //实现各个关键字查找
{
case '1':
return strcmp(q-number ,p-number )0||strcmp(q-con ,p-number )==0 ; //排序条件及查找条件
case '2':
return strcmp(q-name ,p-name )0||strcmp(q-con ,p-name )==0 ;
case '3':
return strcmp(q-sex ,p-sex )0||strcmp(q-con ,p-sex )==0 ;
case '4':
return strcmp(q-borth ,p-borth)0 ||strcmp(q-con ,p-borth )==0 ;
case '5':
return strcmp(q-degree ,p-degree )0||strcmp(q-con ,p-degree )==0 ;
case '6':
return strcmp(q-business ,p-business )0||strcmp(q-con ,p-business)==0 ;
case '7':
return strcmp(q-phone ,p-phone )0 ||strcmp(q-con ,p-phone)==0;
case '8':
return strcmp(q-place ,p-place )0||strcmp(q-con ,p-place )==0;
default :
exit(0);
}
}
//查找函数
struct Stuff *Ser(struct Stuff *head)
{
struct Stuff *p=NULL,*q,a={"\0","\0","\0","\0","\0","\0","\0","\0"}; //防止判断时错误
int flag; //查找判断
char ch,sh;
q=a;
while(1)
{
printf("请输入要查找的条件:1.编号2.姓名3.性别4.出生年月5.学历6.职务7.电话8.住址0.退出\n");
scanf(" %c",ch);
if(ch=='0')
break;
if(ch'1'||ch'8')
{
printf("输入错误,请重新输入!\n");
continue;
}
fflush(stdin);
printf("请输入:");
gets(q-con );
p=head; //指向表头
flag=0;
while(p!=NULL)
{
if(Sel(ch,p,q))
{
printf("员工信息如下:\n");
printf(" 编号 | 姓名 | 性别 | 出生年月 | 学历 | 职务 | 电话 | 住址 \n%s %s %s %s %s %s %s %s\n"
,p-number ,p-name ,p-sex ,p-borth ,p-degree ,p-business ,p-phone ,p-place );
printf("是否需要:1.更改 2.删除 3.继续\n");
scanf(" %c",sh);
if(sh=='1')
Chn(head,p-number); //调用更改函数
else if(sh=='2')
head=Del(head,p-number); //调用删除函数,得到的head必须return
flag=1;
break;
}
p=p-next ;
}
if(flag==0)
printf("没有找到该员工信息!\n");
}
return head;
}
//更改函数
//输入参数:n[10] 为员工编号
void Chn(struct Stuff *head,char n[10])
{
struct Stuff *p=head;
int flag=0;
if(head==NULL)
printf("未找到员工信息!\n");
else
{
while(p!=NULL)
{
if(!strcmp(p-number,n))
{
printf("请输入新的信息:\n编号|姓名|性别|出生年月|学历|职务|电话|住址\n");
scanf("%s%s%s%s%s%s%s%s",p-number ,p-name ,p-sex ,p-borth ,p-degree ,p-business ,p-phone ,p-place );
printf("员工信息如下:\n");
flag++;
break;
}
p=p-next;
}
if(flag==0)
printf("未找到该员工信息!\n");
}
Prf(head);
}
//删除函数
//输入参数:n为员工编号
//输出参数:头指针
struct Stuff *Del(struct Stuff *head,char n[10])
{
struct Stuff *p,*pr;
int flag;
flag=0;
p=head,pr=head;
if(head==NULL)
printf("未找到员工信息!\n");
else
{
while(strcmp(p-number ,n)p-next !=NULL)
{
pr=p;
p=p-next ;
}
if(!strcmp(p-number ,n))
{
if(p==head)
head=p-next ;
else
pr-next=p-next ;
free(p);
printf("删除成功!\n");
i--;
}
else
printf("未找到员工信息!\n");
}
Prf(head);
return head;
}
//输出函数
void Prf(struct Stuff *head)
{
struct Stuff *p=head;
int i=1;
while(p!=NULL)
{
printf("%d. %s %s %s %s %s %s %s %s\n"
,i++,p-number ,p-name ,p-sex ,p-borth ,p-degree ,p-business ,p-phone ,p-place);
p=p-next ;
}
}
//释放函数
void Fre(struct Stuff *head)
{
struct Stuff *p;
while(head!=NULL)
{
p=head;
head=head-next ;
free(p);
}
}
只有400行不到,分的如果你真的看懂了,就应该自己写,程序是死的人是活的,自己动手改改吧。
Q5: 200分求救!C语言饭卡管理系统代码!
花半小时简单的写了一下,你看看行不行.
最开始运行程序的时候,要先建立文件,就是要选菜单1.
#include stdio.h
struct Card
{
int ID; //卡号
char name[20];
double value; //金额
int flag; //挂失信息
}
card[1000]; //假设最多1000张
int counts; //当前已有饭卡数量
FILE * fp;
int menu()
{
int choose;
printf("|-------------------------------|\n");
printf("| 请输入选项编号(0--7) |\n");
printf("|-------------------------------|\n");
printf("| 0——退出 |\n");
printf("| 1——建立饭卡文件 |\n");
printf("| 2——买饭 |\n");
printf("| 3——续钱 |\n");
printf("| 4——添加新饭卡 |\n");
printf("| 5——注销旧饭卡 |\n");
printf("| 6——设置与解除挂失 |\n");
printf("| 7——显示全部饭卡信息 |\n");
printf("|-------------------------------|\n");
scanf("%d",choose);
return choose;
}
void write_file()
{
int i;
FILE * f;
f=fopen("card.dat","w");
for(i=0;icounts;i++)
fprintf(f,"%d %s %lf %d\n",card[i].ID,card[i].name,card[i].value,card[i].flag);
fclose(f);
}
void create_file() //如果已经存在了card.dat那么就打开该文件
{
int i=0;
fp=fopen("card.dat","r");
if(fp!=NULL) //如果已经存在
{
printf("文件已经存在!\n");
while(fscanf(fp,"%d%s%lf%d",card[i].ID,card[i].name,card[i].value,card[i].flag)!=EOF)
i++;
counts=i;
fclose(fp);
return ;
}
fp=fopen("card.dat","w");
printf("输入卡号,姓名,金额,挂失信息(0/1)(卡号-1表示输入结束!):\n");
while(scanf("%d%s%lf%d",card[i].ID,card[i].name,card[i].value,card[i].flag),card[i].ID!=-1)
i++;
counts=i;
fclose(fp);
write_file();
}
void buy1(int card_id,double cost)
{
int i;
for(i=0;icounts;i++)
{
if(card[i].ID==card_id)
{
if(card[i].flag==1)
{
printf("本卡已挂失!\n");
return ;
}
if(card[i].value5)
{
printf("金额不足!\n");
return ;
}
printf("%lf\n",card[i].value);
card[i].value-=cost;
printf("%lf\n",card[i].value);
}
}
printf("非法卡!\n");
}
void buy()
{
int id;
double v;
printf("输入卡号和消费金额:\n");
scanf("%d%lf",id,v);
buy1(id,v);
}
void add_value()
{
int id,i;
double v;
printf("输入卡号和续钱金额:\n");
scanf("%d%lf",id,v);
for(i=0;icounts;i++)
{
if(card[i].ID==id)
{
printf("%lf\n",card[i].value);
card[i].value+=v;
printf("%lf\n",card[i].value);
printf("ok!\n");
return ;
}
}
printf("error!\n");
}
void add_card()
{
int i=counts;
printf("输入卡号,姓名,金额,挂失信息(0/1)(卡号-1表示输入结束!):\n");
while(scanf("%d%s%lf%d",card[i].ID,card[i].name,card[i].value,card[i].flag),card[i].ID!=-1)
i++;
counts=i;
}
void del_card()
{
int id;
int i,j;
printf("输入要注销的卡号:\n");
scanf("%d",id);
for(i=0;icounts;i++)
{
if(card[i].ID==id)
{
for(j=i;jcounts-1;j++)
card[j]=card[j+1];
printf("注销成功!\n");
return ;
}
}
}
void set_flag()
{
int id,i,f;
printf("输入卡号和挂失信息(1:挂失,0:解除挂失)\n");
scanf("%d%d",id,f);
for(i=0;icounts;i++)
{
if(card[i].ID==id)
{
card[i].flag=f;
printf("设置完成 !\n");
break;
}
}
}
void output()
{
int i;
printf("%6s%11s%10s%6s\n","卡号","姓名","金额","挂失");
for(i=0;icounts;i++)
printf("%6d%11s%10.3lf%2d\n",card[i].ID,card[i].name,card[i].value,card[i].flag);
}
void main()
{
int m;
while(m=menu(),m)
{
switch(m)
{
case 1:
create_file();
break;
case 2:
buy();
break;
case 3:
add_value();
break;
case 4:
add_card();
break;
case 5:
del_card();
break;
case 6:
set_flag();
break;
case 7:
output();
break;
default:
printf("输入有误,重新输入!\n");
}
}
write_file(); //退出系统的时候,把数据保存到文件
}
关于饭卡管理系统java代码和饭卡管理系统java代码怎么写的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。




![【电子书】[职业技术] 《iOS编程基础:Swift、Xcode和Cocoa入门指南》[马特·诺伊贝格][epub+mobi+azw3] 【电子书】[职业技术] 《iOS编程基础:Swift、Xcode和Cocoa入门指南》[马特·诺伊贝格][epub+mobi+azw3]](https://www.04ip.com/template/qe/style/noimg/19.jpg)

![【IOS】[A11]李明杰Swift从入门到精通视频教程完整版下载 【IOS】[A11]李明杰Swift从入门到精通视频教程完整版下载](https://www.04ip.com/template/qe/style/noimg/10.jpg)

![【IOS】[A14]两套 Swift视频教程 完整版 下载 【IOS】[A14]两套 Swift视频教程 完整版 下载](https://www.04ip.com/template/qe/style/noimg/18.jpg)