Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.5 kB
2
Indexable
Never
#include<iostream>
#include<string>
using namespace std;

struct CompanyPeople
{
	string FirstName;
	string LastName;
	int Age;
	string Gender;
	int Personal_ID;
	int Unique_Employee_Number;
};
int main() {
	
	CompanyPeople TuanLQ10;
	cout << "Nhap First Name: "; 
	cin >> TuanLQ10.FirstName;
	cout << endl;

	cout << "Nhap Last Name: ";
	cin >> TuanLQ10.LastName; 
	cout << endl;
	
	do {
		cout << "Nhap Age(0->100): ";
		cin >> TuanLQ10.Age;
		cout << endl;
	} while (TuanLQ10.Age < 0 || TuanLQ10.Age>100);
	
	do {
		cout << "Nhap Gender(Male or Female): ";
		getline(cin,TuanLQ10.Gender);
		cout << endl;
	} while ((TuanLQ10.Gender).compare("Male") != 0 && (TuanLQ10.Gender).compare("Female")!=0);

	do {
		cout << "Nhap Personal ID(0->999999999): ";
		cin >> TuanLQ10.Personal_ID;
		cout << endl;
	} while (TuanLQ10.Personal_ID < 0 || TuanLQ10.Personal_ID>999999999);

	do {
		cout << "Nhap Unique Employee Number(0->99999999): ";
		cin >> TuanLQ10.Unique_Employee_Number;
		cout << endl;
	} while (TuanLQ10.Unique_Employee_Number < 0 || TuanLQ10.Unique_Employee_Number > 99999999);

	    cout << "First Name: " << TuanLQ10.FirstName << endl;
	    cout << "Last Name: " << TuanLQ10.LastName << endl;
	    cout << "Age: " << TuanLQ10.Age << endl;
		cout << "Gender: " << TuanLQ10.Gender << endl;
		cout << "Personal ID: " << TuanLQ10.Personal_ID << endl;
		cout << "Unique Employee Number: " << TuanLQ10.Unique_Employee_Number << endl;
	
	return 0;

}