السلام عليكم
أود أن اضيف مصفوفة لإدخال عدد من المستخدمين ومن تم حساب مرتباتهم تم مجموع المرتبات الكلي واخيرا المتوسط الحسابي. لقد قمت بكتابة كود ولكن يقوم بادخال مستخدم واحد فقط
كيف أضيف أكثر من موظف وشكرا
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
const int months=3;
double net_pay;
string EmpName;
string date_of_birth;
int hours;
cout<<"Please enter your name: " ;
cin>>EmpName;
cout<<"enter your birth date: ";
cin>>date_of_birth;
do {
cout<<"How many hours you work everyday: (Please choose 8, 10 or 12): ";
cin>>hours;
} while(hours != 8 && hours != 10 && hours != 12);
cout<< "How many children you have?: ";
cin>>dependents;
if (0<dependents<10) {
if(hours==8) {
net_pay= months*3000;
} else if (hours==10) {
net_pay= (months*3000)+(5*10);
} else if (hours==12) {
net_pay= (months*4000)+(10*10);
}
cout<<" Hello "<<EmpName<<"... Your Salary is "<<net_pay<<endl ;
} else {
cout<<" Please choose correct values"<<endl ;
}
getch();
return 0;
}