business management

#include<iostream>
#include<string> 
#include<iomanip>
#include<stdlib.h>
using namespace std;
class Date //定义日期类
{
public: //The date class needs to be accessed in the employee class, so it is defined as a common (public) type
int year;
int my;
int day;
};
class Worker //define the employee class
{
private:
int num;
string name;
float money;
float award;
float fine;
Date t;
public:
void Show();
void Input();
void Set(Worker &); //Reset function


};
void Worker::Input()
{
cout<<"Number:";
cin>>num;
cout<<"姓名:" ;
cin>>name;
cout<<"Working time: (Year-Month-Day)";
cin>>t.year>>t.mon>>t.day;
while(t.mon>12||t.mon<0||t.day<0||t.day>31)
{
cout<<"The data is invalid, please re-enter the total working time:";
cin>>t.year>>t.mon>>t.day; 

cout<<"Basic salary:";
cin>>money;
cout<<"Bonus:";
cin >> award;
cout<<"Deduct salary:";
cin>>fine; 
}
void Worker::Show()
{
cout<<setw(10)<<"Number"<<setw(10)<<"Name"<<setw(10)<<"Join Work"<<setw(10)<<"Wage"<<setw( 10)<<"bonus"<<setw(10)<<"salary deduction"<<setw(10)<<"salary payable"<<endl;
cout<<setw(10)<<num<<setw(10)<<name<<setw(10)<<t.year<<"-"<<t.mon<<"-"<<t.day<<setw(10)<<money<<setw(10)<<award<<setw(10)<<fine<<setw(10)<<money+award-fine<<endl;


}
void Worker::Set(Worker &n)
{
cout<<"Please enter a new basic salary:";
cin>>money;
n.Show();
}
int main()
{
int n;
Worker m;
while(1)
{
cout<<"---------------------------------"<<endl;
cout<<"Enterprise Management System"<<endl;
cout<<"1. Add 2. Display 3. Modify salary 0. Exit"<<endl;
cout<<"---------------------------------"<<endl; 
cout<<"Please select:";
cin>>n; 

switch(n)

case 1: m.Input();break;
case 2: m.Show();break;
case 3: m.Set(m);break;
default:return 0;break;
}

system("pause");
system("cls");
}



return 0;

}

I just started programming with C++, and I am very unskilled. There are many problems in the compilation process. For example, the upper and lower information shown in the above picture does not completely correspond, and there is a deviation. I've been looking for it for a long time.

After finishing it, I also feel a little sense of accomplishment. This is the relatively long code I have written in the past six months. In the compilation process, although there are some problems, it is much better than before

I will continue to work hard to become a good programmer before graduation.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325485122&siteId=291194637