求C语言 工资管理系统 原代码

求C语言 工资管理系统 原代码,第1张

#include <iostream>

#include <string>

#define MaxHEAP 100

using namespace std

class Elem{

private:

int objectID

int priority

string proName

public:

Elem(int objectID=0,int priority=0){

setID(objectID)

setPri(priority)

setProN(proName)

}

int getID(){

return objectID

}

int getPri(){

return priority

}

string getProN(){

return proName

}

void setID(int id){

objectID=id

}

void setPri(int pri){

priority=pri

}

void setProN(string s)

{

proName=s

}

}

class Heap

{

private:

Elem items[MaxHEAP]

int size

public :

Heap(){

Elem items[MaxHEAP]

setSize(0)}

void setSize(int sz)

{size=sz}

int heapIsEmpty(){

return size==0

}

void heapInsert(Elem newItem)

{if(size<MaxHEAP)

{

items[size]=newItem

int place=size

int parent=(place-1)/2

while((parent>=0)&&(items[parent].getPri()<items[place].getPri()))

{

Elem temp=items[parent]

items[parent]=items[place]

items[place]=temp

place=parent

parent=(place-1/2)

}

++size

}

heapRebuild(0)

}

Elem heapDelete(int ID)

{

Elem rootItem

if(!heapIsEmpty())

{

for(int i=0i<sizei++)

if(items[i].getID()==ID)

{rootItem=items[i]

swap(items[i],items[0])

}

items[0]=items[--size]

heapRebuild(0)

}

else cout<<"\n错误:目录为空"<<endl

return rootItem

}

void heapInit(){

setSize(0)

cout<<"空的项目"<<endl}

void heapView(){

if(size==0){

cout<<"空的项目!"<<endl

}

else{

cout<<"共有项目数: "<<size<<endl

for(int ct=0ct<sizect++){

cout<<"ID: "<<items[ct].getID()<<" 优先级: "<<items[ct].getPri()

<<" 工资数目: " <<items[ct].getProN()<<endl

}

}

}

void search(int ID)

{ int N=0

for(int i=0i<sizei++)

if(items[i].getID()==ID)

{N++

cout<<"ID: "<<items[i].getID()<<" 优先级: "<<items[i].getPri()

<<" 名称: " <<items[i].getProN()<<endl}

if(!N) cout<<"未找到匹配的ID"<<endl

}

void heapRebuild(int root)

{

int child=2*root+1

if(child<size)

{

int rightChild=child+1

if((rightChild<size)&&(items[rightChild].getPri()>=items[child].getPri()))

{child=rightChild

}

if(items[root].getPri()<=items[child].getPri())

{

Elem temp=items[root]

items[root]=items[child]

items[child]=temp

heapRebuild(child)

}

}

}

}

class priQueue

{private:

Heap h

public:

priQueue(){

Heap()

}

int priIsEmpty(){

return h.heapIsEmpty()

}

void priInit(){

h.heapInit()

}

void priInsert(Elem newItem){

h.heapInsert(newItem)

}

Elem priDelete(int ID){

return h.heapDelete(ID)

}

void priView(){h.heapView()

}

void search(int ID)

{

h.search(ID)

}

}

void showMenu(){

cout<<"------------------------------------------------"<<endl

cout<<"-----------------*工资管理系统*-----------------"<<endl

cout<<"------------------------------------------------"<<endl

cout<<" 1.重置"<<endl

cout<<" 2.输入"<<endl

cout<<" 3.删除"<<endl

cout<<" 4.查询"<<endl

cout<<" 5.打印"<<endl

cout<<" 0.退出"<<endl

cout<<"------------------------------------------------"<<endl

}

void showTip(){

cout<<"---------------------------------^_^-- *** 作完成!"<<endl

cout<<"------------------------------------选择0-5继续"<<endl

}

int main(){

string i="-1"

int ID,PRI

string proName

Elem in

priQueue PQ

PQ.priInit()

system("cls")

showMenu()

cout<<"选择菜单中的数字以便处理数据!"<<endl

cin>>i

system("cls")

while(i!="0")

{ if(i=="1")

{ system("cls")

showMenu()

cout<<"你选择了1,项目将全部清空:"<<endl

PQ.priInit()

showTip()

}

else if(i=="2")

{system("cls")

showMenu()

cout<<"你选择了2,输入ID,优先级,工资"<<endl

cout<<"输入 ID(数字):"<<endl

cin>>ID

cout<<"输入优先级(数字):"<<endl

cin>>PRI

cout<<"输入工资数目(数字):"<<endl

cin>>proName

in.setID(ID)

in.setPri(PRI)

in.setProN(proName)

PQ.priInsert(in)

showTip()

}

else if(i=="3")

{system("cls")

showMenu()

cout<<"你选择了3,请选择你要删除的ID号"<<endl

cin>>ID

PQ.priDelete(ID)

showTip()

}

else if(i=="4")

{system("cls")

showMenu()

cout<<"你选择了4,输入要查找的项目ID号"<<endl

cin>>ID

PQ.search(ID)

showTip()

}

else if(i=="5")

{system("cls")

showMenu()

cout<<"你选择了5,整个系统工资情况显示如下:"<<endl

PQ.priView()

showTip()

}

else {

system("cls")

showMenu()

cout<<"无效输入!"<<endl

}

cin>>i

system("cls")

}

return 0

}

#include<fstream>

#include<iostream>

#include<string>

#include<iomanip>

#include<stdlib.h>

using namespace std

//常变量(供修改用):

const int n1=2,n2=2,n3=4,n4=2 /*定义公司各类职工人数(方便修改)

(n1:技术员人数;n2:经理人数;n3:销售员人数;n4:销售经理人数 )*/

const double m_salary=8000 //经理固定月工资

const double hourpay=100 //技术员小时工资

const double basicpay=5000 //销售经理的底薪

const double s_proportion=4.0/100 //销售员的工资提成比例

const double sm_proportion=0.5/100 //销售经理的提成比例

//声明部分:

void menu() //主菜单

void menu2() //数据输入二级菜单

void menu3() //数据打印二级菜单

void data_input()//数据输入函数

void data_print()//数据打印

void charthead1()//制作表头1函数,统计销售额

void charthead2()//制作表头2函数,数据打印

void chartend()//制作表尾

void statistics()//数据统计

double sm_salary()//销售经理工资计算

void sm_print()//销售经理打印数据

void data_find()//数据查询

void data_save()//数据备份

ofstream outfile//打开磁盘文件流对象

string f_name //全局变量(查询用)

//定义类:

class Employee //雇员类(基类)

{

public:

void input() //数据输入函数

{

cout<<"编号:"

cin>>num

cout<<"其姓名:"

cin>>name

cout<<"性别(m/w):"

cin>>sex

cout<<"年龄:"

cin>>age

}

void print() //打印数据函数

{

cout<<"├─────┼─────┼─────┼─────┼─────┤"<<endl

cout<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"<<setw(7)<<pay<<" │"<<endl

}

void find() //查询函数

{

if(f_name==name)

{

charthead2()

print()

chartend()

cout<<endl

}

}

void save() //备份数据函数

{

outfile<<"├─────┼─────┼─────┼─────┼─────┤"<<endl

outfile<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"<<setw(7)<<pay<<" │"<<endl

}

protected:

int num//职工号

string name //职工姓名

char sex//职工性别

int age//职工年龄

double pay//职工工资

}

class Technician:public Employee //技术员类(公有继承)

{

public:

void input()

{

cout<<"技术员的"

Employee::input()

cout<<"工作时间:"

cin>>worktime

}

void print()

{ pay=worktime*hourpay

Employee::print()

}

void find()

{

Employee::find()

}

void save()

{ pay=worktime*hourpay

Employee::save()

}

protected:

double worktime //工作时间(小时)

}

class Manager:public Employee //经理类

{

public:

void input()

{

cout<<"经理的"

Employee::input()

}

void print()

{ pay=m_salary

Employee::print()

}

void find()

{

Employee::find()

}

void save()

{ pay=m_salary

Employee::save()

}

}

class Sell_manager:public Employee //销售经理类

{

public:

void input()

{ cout<<"销售经理的"

Employee::input()

}

int sm_number()//调用销售经理职工号

{

return num

}

string sm_name()//调用销售经理姓名

{

return name

}

void print()

{

cout<<"├─────┼─────┼─────┼─────┼─────┤"<<endl

cout<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"

}

void save()

{

outfile<<"├─────┼─────┼─────┼─────┼─────┤"<<endl

outfile<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"

}

}

class Seller:public Employee //销售员类

{

public:

Seller(){ sold_amount=0 } //构造函数,销售额初始化为0

void input()

{

cout<<"销售员的"

Employee::input()

cout<<"销售额:"

cin>>sold_amount

cout<<"所属销售经理的编号:"

cin>>nu

}

void grade() //销售员业绩输出

{

cout<<"├─────┼─────┼─────┤"<<endl

cout<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(7)<<sold_amount<<" │"<<endl

}

void print()

{ pay=sold_amount*s_proportion

cout<<"├─────┼─────┼─────┼─────┼─────┼───────────┤"<<endl

cout<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"<<setw(7)<<pay<<" │"<<setw(13)<<nu<<" │"<<endl

}

int s_number() //调用销售员所属销售经理职工号

{

return nu

}

double amount()//调用销售员销售额

{

return sold_amount

}

void find()

{ if(f_name==name)

{cout<<"┌─────┬─────┬─────┬─────┬─────┬───────────┐"<<endl

cout<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │ 所属部门经理编号 │"<<endl

print()

cout<<"└─────┴─────┴─────┴─────┴─────┴───────────┘"

}

}

void save()

{ pay=sold_amount*s_proportion

outfile<<"├─────┼─────┼─────┼─────┼─────┼───────────┤"<<endl

outfile<<"│"<<setw(6)<<num<<"│"<<setw(8)<<name<<" │"<<setw(6)<<sex<<"│"<<setw(6)

<<age<<"│"<<setw(7)<<pay<<" │"<<setw(13)<<nu<<" │"<<endl

}

protected:

double sold_amount //销售额

int nu //所属销售经理职工号

}

//定义全局对象数组

Technician t[n1] //技术员

Manager m[n2]//经理

Seller s[n3]//销售员

Sell_manager sm[n4] //销售经理(下属若干销售员)

//主函数部分:

int main()

{

char n

menu()

for(int i=0i<1000i++) //设定循环次数(便于各项 *** 作的切换及方便查询)

{

cin>>n

switch(n)

{

case'1'://数据输入

cout<<endl<<"您所选 *** 作为数据输入,请继续——"<<endl<<endl

data_input()

cout<<endl

menu()

break

case'2'://数据统计

cout<<endl<<"您所选 *** 作为数据统计,请继续——"<<endl<<endl

statistics()

cout<<endl<<"销售经理按工资排序为:"<<'\n'<<endl

sm_print()

cout<<endl

menu()

break

case'3'://数据打印

cout<<endl<<"您所选 *** 作为数据打印,请继续——"<<endl<<endl

cout<<'\a'<<"数据打印中,请等待……"<<'\n'<<'\n'<<endl

cout<<"职工基本情况一览表如下:"<<'\n'<<endl

data_print()

cout<<endl<<endl

cout<<'\a'<<"——数据打印完毕——"<<'\n'<<'\n'<<endl

menu()

break

case'4'://数据查询

cout<<endl<<"您所选 *** 作为数据查询,请继续——"<<endl<<endl

cout<<"请输入您要查询的职工姓名: "

cin>>f_name

cout<<endl<<"——正在查询,请等待——"<<endl<<endl

cout<<"您查询的信息如下:"<<endl<<endl

data_find()

cout<<endl<<endl

menu()

break

case'5'://数据备份

outfile.open("C++程序设计实习.txt",ios::out)//打开磁盘文件流对象

cout<<endl<<"您所选 *** 作为数据备份,请继续——"<<endl<<endl

outfile<<"职工基本情况一览表如下:"<<'\n'<<endl

data_save()

outfile.close()

cout<<endl<<endl

cout<<'\a'<<"——数据备份完成,请继续——"<<endl<<endl

menu()

break

case'0'://退出系统

cout<<endl<<"您所选 *** 作为退出系统,请确认——"<<endl<<endl

cout<<" 是( y )"<<" "<<"否( n ) "

cin>>n

if(n=='y')

{ cout<<'\n'<<"——请按任意键退出系统——"<<endl exit(0)cout<<endl}

else menu()

break

default:

cout<<endl<<"——出错!请重新选择 *** 作! "<<'\n'<<endl

menu()

break

}

}

return 0

}

//自定义函数部分:

void menu() //菜单函数

{

cout<<" ★★小型公司工资管理系统★★ "<<endl

cout<<"┌──────────────┐"<<endl

cout<<"│ 请选择您所需的 *** 作 │"<<endl

cout<<"│ 数据输入:1,并按回车键; │"<<endl

cout<<"│ 数据统计:2,并按回车键; │"<<endl

cout<<"│ 数据打印:3,并按回车键; │"<<endl

cout<<"│ 数据查询:4,并按回车键; │"<<endl

cout<<"│ 数据备份:5,并按回车键; │"<<endl

cout<<"│ 退出系统:0,并按回车键; │"<<endl

cout<<"└──────────────┘"<<endl

cout<<" 请选择一个 *** 作:"

}

void menu2() //数据输入二级菜单函数

{

cout<<" ★★小型公司工资管理系统★★ "<<endl

cout<<"┌──────────────────┐"<<endl

cout<<"│ 请选择您所需的 *** 作 │"<<endl

cout<<"│ 经理数据输入:1,并按回车键; │"<<endl

cout<<"│ 技术员数据输入 :2,并按回车键; │"<<endl

cout<<"│ 销售员数据输入 :3,并按回车键; │"<<endl

cout<<"│ 销售经理数据输入:4,并按回车键; │"<<endl

cout<<"│ 返回上一级 :5,并按回车键; │"<<endl

cout<<"└──────────────────┘"<<endl

cout<<" 请选择一个 *** 作:"

}

void menu3() //数据打印二级菜单函数

{

cout<<" ★★小型公司工资管理系统★★ "<<endl

cout<<"┌──────────────────┐"<<endl

cout<<"│ 请选择您所需的 *** 作 │"<<endl

cout<<"│ 经理数据打印:1,并按回车键; │"<<endl

cout<<"│ 技术员数据打印 :2,并按回车键; │"<<endl

cout<<"│ 销售员数据打印 :3,并按回车键; │"<<endl

cout<<"│ 销售经理数据打印:4,并按回车键; │"<<endl

cout<<"│ 返回上一级 :5,并按回车键; │"<<endl

cout<<"└──────────────────┘"<<endl

cout<<" 请选择一个 *** 作:"

}

void data_input() //数据输入函数

{

char pint i

menu2()

for(int j=0j<100j++)

{

cin>>p

if(p=='5') break

else

{

switch(p)

{

case'1':

for(i=0i<n2i++)

m[i].input()

cout<<endl<<"-----------------------------------------------------"<<endlmenu2()break

case'2':

for(i=0i<n1i++)

t[i].input()

cout<<endl<<"-----------------------------------------------------"<<endlmenu2()break

case'3':

for(i=0i<n3i++)

s[i].input()

cout<<endl<<"-----------------------------------------------------"<<endlmenu2()break

case'4':

for(i=0i<n4i++)

sm[i].input()

cout<<endl<<"--------------------------------------------------"<<endlmenu2()break

}

}

}

}

void charthead1() //制表头1(数据统计用)

{

cout<<"┌─────┬─────┬─────┐"<<endl

cout<<"│职 工 号 │ 姓 名 │ 销 售 额 │"<<endl

}

void charthead2() //制表头2(数据打印及销售经理数据统计用)

{

cout<<"┌─────┬─────┬─────┬─────┬─────┐"<<endl

cout<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │"<<endl

}

void chartend() //制表尾(数据打印及销售经理数据统计用)

{

cout<<"└─────┴─────┴─────┴─────┴─────┘"

}

void statistics() //数据统计函数

{ int i,j

for(i=0i<n4i++)

{ double sum=0

cout<<endl<<"职工号为 "<<sm[i].sm_number()<<" 销售经理 "<<sm[i].sm_name()

<<" 下属销售员的业绩为:"<<endl<<endl

charthead1()

for(j=0j<n3j++)

if(s[j].s_number()==sm[i].sm_number())

{

sum=sum+s[j].amount()

s[j].grade()

}

cout<<"├─────┼─────┴─────┤"<<endl

cout<<"│销售额总计│"<<setw(12)<<sum<<" │"<<endl

cout<<"└─────┴───────────┘"<<endl

}

}

double salary[n4]

double sm_salary() //销售经理工资计算及排序

{

int i,jdouble a Sell_manager b

for(int k=0k<n4k++)

salary[k]=0

for(i=0i<n4i++)

{ double sum=0

for(j=0j<n3j++)

if(s[j].s_number()==sm[i].sm_number())

{ sum=sum+s[j].amount()

salary[i]=sum*sm_proportion+basicpay

}

}

for( j=0j<n4-1j++)

for( i=0i<n4-1-ji++)

if(salary[i]<salary[i+1])

{ a=salary[i+1]salary[i+1]=salary[i]salary[i]=a

b=sm[i+1]sm[i+1]=sm[i]sm[i]=b

}

return 0

}

void sm_print()

{

sm_salary()

charthead2()

for(int i=0i<n4i++)

{ sm[i].print()

cout<<setw(7)<<salary[i]<<" │"<<endl

}

chartend()

cout<<endl

}

void data_print() //数据打印

{

char pint i,j

menu2()

for(j=0j<100j++)

{

cin>>p

if(p=='5') break

else

{

switch(p)

{case'1':

cout<<endl<<"经理"<<endl //经理信息

charthead2()

for(i=0i<n2i++)

m[i].print()

chartend()

cout<<endl<<endl<<"-----------------------------------------------------------------------"<<endl

menu3()break

case'2':

cout<<endl<<"技术员"<<endl //技术员信息

charthead2()

for(i=0i<n1i++)

t[i].print()

chartend()

cout<<endl<<endl<<"-----------------------------------------------------------------------"<<endl

menu3()break

case'3':

cout<<endl<<"销售员"<<endl //销售员信息

cout<<"┌─────┬─────┬─────┬─────┬─────┬───────────┐"<<endl

cout<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │ 所属部门经理编号 │"<<endl

for(i=0i<n3i++)

s[i].print()

cout<<"└─────┴─────┴─────┴─────┴─────┴───────────┘"

cout<<endl<<endl<<"------------------------------------------------------------------------"<<'\n'<<endl

menu3()break

case'4':

cout<<endl<<"销售经理"<<endl //销售经理信息

sm_salary()

sm_print()

cout<<endl<<endl<<"-----------------------------------------------------------------------"<<endl<<endl

menu3()break}

}

}

}

void data_find() //数据查询函数

{

for(int i=0i<n1i++)

t[i].find()

for(i=0i<n2i++)

m[i].find()

for(i=0i<n3i++)

s[i].find()

for(i=0i<n4i++)

if(f_name==sm[i].sm_name())

{ charthead2()

sm[i].print()

cout<<setw(7)<<salary[i]<<" │"<<endl

chartend()

cout<<endl

break

}

}

void data_save() //数据备份函数

{

outfile<<endl<<"技术员"<<endl //技术员信息

outfile<<"┌─────┬─────┬─────┬─────┬─────┐"<<endl

outfile<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │"<<endl

for(int i=0i<n1i++)

t[i].save()

outfile<<"└─────┴─────┴─────┴─────┴─────┘"

outfile<<endl<<endl<<"---------------------------------------------------------------------------"<<endl

outfile<<endl<<"经理"<<endl //经理信息

outfile<<"┌─────┬─────┬─────┬─────┬─────┐"<<endl

outfile<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │"<<endl

for(i=0i<n2i++)

m[i].save()

outfile<<"└─────┴─────┴─────┴─────┴─────┘"

outfile<<endl<<endl<<"----------------------------------------------------------------------------"<<endl

outfile<<endl<<"销售经理"<<endl //销售经理信息

sm_salary()

outfile<<"┌─────┬─────┬─────┬─────┬─────┐"<<endl

outfile<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │"<<endl

for(i=0i<n4i++)

{ sm[i].save()

outfile<<setw(7)<<salary[i]<<" │"<<endl}

outfile<<"└─────┴─────┴─────┴─────┴─────┘"

outfile<<endl<<endl<<"----------------------------------------------------------------------------"<<endl<<endl

outfile<<endl<<"销售员"<<endl //销售员信息

outfile<<"┌─────┬─────┬─────┬─────┬─────┬───────────┐"<<endl

outfile<<"│ 职 工 号 │ 姓 名 │ 性 别 │ 年 龄 │ 工 资 │ 所属部门经理编号 │"<<endl

for(i=0i<n3i++)

s[i].save()

outfile<<"└─────┴─────┴─────┴─────┴─────┴───────────┘"

outfile<<endl<<endl<<"-----------------------------------------------------------------------------"<<'\n'<<endl

}

分数太低了。这个不好做啊。

#include <stdio.h>

#include <malloc.h>

#include <string.h>

#include <conio.h>

#define N 2

typedef struct Workers

{

int id

char name[9]

char sex  

int age

int sal

struct Workers *next

}  worker

worker *head

int odd=0,even=0

void initList()

{

    head=(worker *)malloc(sizeof(worker))

    head->next=NULL

}

void getMsg()

{

    int i

    worker *newD,*p=head

    while(p->next)

    {

        p=p->next

    }

    for(i=0i<Ni++)

    {

        newD=(worker *)malloc(sizeof(worker))

        newD->next=NULL

        printf("please enter date\nid  name   sex   age  salary \n")

        scanf("%d %s %c %d %d",&newD->id,newD->name,&newD->sex,&newD->age,&newD->sal)

        p->next=newD

        p=p->next

    }

}

void saveData()

{

    FILE *fpwd,*fpwo

    worker *p=head

    FILE *fp=fopen("output.txt","wb+")

    fpwd=fopen("worker3.txt","wb+")

    fpwo=fopen("worker4.txt","wb+")

    odd=even=0

    while(p->next)

    {

        p=p->next

        fwrite(p,sizeof(worker),1,fp)

        if(p->id%2==0){

            even++

            fwrite(p,sizeof(worker),1,fpwo)}

        else{

            even++

            fwrite(p,sizeof(worker),1,fpwd)}

    }

    fclose(fp)

    fclose(fpwd)

    fclose(fpwo)

}

void readData()

{

    FILE *fpint i

    worker *p,*newD

    p=head

    fp=fopen("output.txt","rb+")

                                                                                               

    while(p->next)

    {

        p=p->next

    }

    for(i=0i<Ni++)

    {

        newD=(worker *)malloc(sizeof(worker))

        newD->next=NULL

        fread(newD,sizeof(worker),1,fp)

        p->next=newD

        p=p->next

    }

    fclose(fp)

}

void showodd()

{  

    FILE *fpint i

    fp=fopen("worker3.txt","rb+")

        printf("以下为奇数\n")

    while(!feof(fp))

    {

        worker date

        fread(&date,sizeof(worker),1,fp)

        printf("%d %s %c %d %d\n",date.id,date.name,date.sex,date.age,date.sal)

    }

    fclose(fp)

}

void showeven()

{

    FILE *fpint i

    fp=fopen("worker4.txt","rb+")

        printf("以下为偶数\n")

    while(!feof(fp))

    {  

        worker date

        fread(&date,sizeof(worker),1,fp)

        printf("%d %s %c %d %d\n",date.id,date.name,date.sex,date.age,date.sal)

    }

    fclose(fp)

}

void main()

{

    while(1){

    worker *p

    char ch

    initList()

    p=head

    printf("\nplease select 1,2,others \n")

    ch=getch()

    if(ch=='1')  

    {

    getMsg()

    saveData()

    }

    else if(ch=='2')  

    {

        readData()

        while(p->next)

        {  

        p=p->next

        printf("%d %s %c %d %d\n",p->id,p->name,p->sex,p->age,p->sal)

        }

    }

    else

    {

                                                                                                

        printf("are u need to show odd and even \n")

        ch=getch()

        if(ch=='1')

        {

            showodd()

            showeven()

        }

                                                                                               

                                                                                               

    }              

                                                                                           

                                                                                           

    }

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11862929.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存