Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
2.3 kB
2
Indexable
Never
#include <iostream>
using namespace std;
#define MAX_Number 9999
#define MIN_Number 1000
#define div 100000000

void identification();
void Cheking_ID();
void menu();
void Checking_Credit();
void Cheking_Age();
//void menu();

//enum menu {join = 1, details, leave, exit};

int main()
{
	
	//menu();
	identification();
	Cheking_ID();
	menu();

	Checking_Credit();
	Cheking_Age();

	return 0;
}

void identification()
{
	cout << "Enter name and press '.' at the end:" << endl;
	bool strValid = false;
	while (!strValid)
	{
		char inputChar = getc(stdin);
		if (inputChar < 'A' || inputChar>'Z')
		{
			continue;
		}
		bool scanningActive = true;
		while (scanningActive)
		{
			char inputChar = getc(stdin);
			if (inputChar == '.')
			{
				strValid = true;
				break;
			}

			if (inputChar < 'a' || inputChar>'z')
			{
				break;
			}

		}
	}
}

void Cheking_ID()
{
	long id;

	while (true)
	{
		cout << "Enter id: ";
		cin >> id;
		cin.clear();
		cin.ignore(1000, '\n');

		unsigned int check = id / div;

		if (id / div > 0 && id / div < 10)
			break;
		cout << "Please provide correct id:" << endl;
	}
}

void menu()
{
	cout << "\n\t\tMENU :" << endl;
	cout << "Press 1\nI would like to know how much I need to pay this month." << endl;
	cout << "Press 2\nI would like to know more about you." << endl;
	cout << "Press 3\nI would like to speak with a real human." << endl;
	cout << "Press 4\nI want to return to the main menu." << endl;
}

int choise = 0;

void Checking_Credit()
{
	int Card_NUM = 0;
	bool flag = true;

	cout << "Enter 4 last number of your card:" << endl;
	cin >> Card_NUM;
	while (Card_NUM > 9999 || Card_NUM < 1000)
	{
		flag = false;
		if (flag == false)
		{
			cout << "Error! Please try again:" << endl;
			cin >> Card_NUM;
		}
	}

	cout << "Correct" << endl;
}

void Cheking_Age()
{
	int age = 0;
	bool flag = 0;
	cout << "Enter your age:" << endl;
	cin >> age;

	while (age > 120 || age < 18)
	{
		flag == false;
		if (flag == false)
		{
			cout << "Your age is incorrect, Please try again:" << endl;
			cin >> age;
		}
	}
	cout << "Correct" << endl;

}

/*
void Email_account()
{
	char Email;
	cout << "Enter your email" << endl;
	cin >> Email;
	
}
*/