#include<fstream> #include<iostream> #include<string> using namespace std; int n; int main() { int num[1000],wage[1000]; string name[1000],edu[1000],sec[1000],add[1000],tel[1000],age[1000]; void set(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void interview(int *a,string *b,string *c,string*d,string *e,int*f,string *g,string *h); void check(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void sor(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void del(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void cha(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void sta(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void insert(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); void read(int *a,string *b,string *c,string *d,string *e,int*f,string *g,string *h); cout<<" ★欢迎使用职工信息管理系统★"<<endl<<endl; cout<<"请输入本单位有多少职工:"<<endl; cin>>n; for(int i=1;i++;) { int m; cout<<" 请选择菜单功能:"<<endl; cout<<"输入请按1"<<endl; cout<<"浏览请按2"<<endl; cout<<"查询请按3"<<endl; cout<<"排序请按4"<<endl; cout<<"删除请按5"<<endl; cout<<"修改请按6"<<endl; cout<<"统计请按8"<<endl; cout<<"添加请按7"<<endl; cout<<"退出请按0"<<endl;cin>>m; if(m==1) {set(num,name,sec,age,edu,wage,add,tel); } if(m==2) { read(num,name,sec,age,edu,wage,add,tel); interview(num,name,sec,age,edu,wage,add,tel); } if(m==3) { read(num,name,sec,age,edu,wage,add,tel); check(num,name,sec,age,edu,wage,add,tel); } if(m==4) { read(num,name,sec,age,edu,wage,add,tel); sor(num,name,sec,age,edu,wage,add,tel); } if(m==5) { read(num,name,sec,age,edu,wage,add,tel); del(num,name,sec,age,edu,wage,add,tel); } if(m==6) { read(num,name,sec,age,edu,wage,add,tel); cha(num,name,sec,age,edu,wage,add,tel); } if(m==8) { read(num,name,sec,age,edu,wage,add,tel); sta(num,name,sec,age,edu,wage,add,tel); } if(m==7) { read(num,name,sec,age,edu,wage,add,tel); insert(num,name,sec,age,edu,wage,add,tel); } if(m==0)break; } return 0; } //输入数值 void set(int *a,string *b,string *c,string *d,string *e,int *f,string *g,string *h) { ofstream outfile("fl.txt",ios::out); if(! outfile) {cerr<<"open error"<<endl; exit(1); } for(int i=0;i<n;i++) { cout<<"请输入第"<<i+1<<"位职工的个人信息并按下面提示操作"<<endl; cout<<"请输入第"<<i+1<<"位职工的职工号:";cin>>a[i];outfile<<a[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的姓名:";cin>>b[i];outfile<<b[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的性别:";cin>>c[i];outfile<<c[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的年龄:";cin>>d[i];outfile<<d[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的学历:";cin>>e[i];outfile<<e[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的工资:";cin>>f[i];outfile<<f[i]<<" "; cout<<"请输入第"<<i+1<<"位职工的地址:";cin>>g[i];outfile<<g[i]<<" "; <上一个:我想学习C语言 学它以前先用不用学什么啊? 下一个:c语言 链表是什么。书上的没看太懂
|