帮忙解决一下C语言编程问题,谢谢各位高山啦,,,急啊。。。

[复制链接]
查看11 | 回复2 | 2011-6-14 11:50:21 | 显示全部楼层 |阅读模式
#include
#include
#include
#include
struct {
        int workernumber[10];
        char name[18];
        char sex[10];
        int age[8];
        char education[20];
        char addr[50];
        int tel[20];
float salary[20];
}staff;
FILE*fp;
void Add();
void Search();
void Delete();
void Modify();
void educationway();
void salaryway();
void main()
{
        printf("\t\t********** Welcome To The Staff Management System********\n");
        printf("\t\t\t********1.Add the information********\n");
        printf("\t\t\t********2.Search the infomation********\n");
        printf("\t\t\t********3.Delete the information********\n");
        printf("\t\t\t********4.Modify the information********\n");
        printf("\t\t\t********5.Exit The Staff Management System*********");
        printf("\n\n\n\tif you want to add the information,please input 1;");
        printf("\n\tif you want to search the information,please input 2;");
        printf("\n\tif you want to detele the information,please input 3;");
        printf("\n\tif you want to modify the information,please input 4;");
        printf("\n\tif you want to exit The Staff Management System,please input 5;\n");
        printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t电信09-1Fxxx");
while (1) {
                printf("\t\t\tplease input i:");
                int i;
                scanf("%d",&i);
                if(i == 1) {
                        Add();
                }
                else if(i == 2) {
                        Search();
                }
                else if(i == 3) {
                        Delete();
                }
                else if(i == 4) {
                        Modify();
                }
                else if(i == 5) break;
                else if(i!=1 || i!=2 || i!=3 || i!=4 || i!=5) printf("input error!!!please input again !");
        }
}
void Add(){
        fp=fopen("d:\\staff.txt","a");
               
        {        printf("\nplease input the information of the staffs\n");
printf("请依次输入:workernumber,name,sex,age,education,addr,tel,salary输入:\n");
        scanf("%d%s%s%d%s%s%d%f\n", staff.workernumber,staff.name,staff.sex,staff.age,staff.education,staff.addr,staff.tel,staff.salary);
fprintf(fp,"\n\t\t\t\t公司员工信息:\t%d\t%s\t%s\t%d\t%s\t%s\t%d\t%f\n", staff.workernumber,staff.name,staff.sex,staff.age,staff.education,staff.addr,staff.tel,staff.salary);
       
        printf("\n信息录入成功!!!\n");
        }
        fclose(fp);
};

回复

使用道具 举报

千问 | 2011-6-14 11:50:21 | 显示全部楼层
一看就是菜鸟,好好看看c。这么简单的还上网问,不就是几个文件操作嘛,没什么难度...
回复

使用道具 举报

千问 | 2011-6-14 11:50:21 | 显示全部楼层
你想问的是什么???咯...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行