-
Notifications
You must be signed in to change notification settings - Fork 0
/
Customer.cpp
59 lines (50 loc) · 1.33 KB
/
Customer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <string>
#include <regex>
#include "Customer.h"
using namespace std;
/*
Author: Tran Hong Nghiep
Contributor: Le Kim Bang, Nguyen Quang Minh
---
Class "Customer" - Status: Working
This file contains the definitions of the functions to implement the operations of the class Customer.
*/
Customer :: Customer() : profileTemplate(){
/*
phoneNumber = "";
firstName = "";
lastName = "";
fullName = "";
*/
}
void Customer :: add_CustomerINFO(){
string tempNum, tempFName, tempLName;
regex pattern_tempNum("^[0-9]{10}$");
/*
Pattern of tempNum
^ => Indicate the start of the string
[0-9]{9} => Require 10 Digits
$ => Indicate the end of the string
*/
bool check_tempNum;
cout << "Provide Your Personal Info" << endl;
do
{
cout << "Phone Number: ";
cin >> tempNum;
check_tempNum = regex_match(tempNum, pattern_tempNum);
if (check_tempNum == false)
cout << "Phone Number \"" << tempNum << "\" is invalid!\n" << endl;
} while(check_tempNum == false);
phoneNumber = tempNum;
cout << "First Name: ";
cin >> tempFName;
cout << "Last Name: ";
cin >> tempLName;
firstName = tempFName;
lastName = tempLName;
fullName = lastName + " " + firstName;
cout<<"\nYour Info is successfully created!"<<endl;
Customer :: profileINFO();
}