name validation html
<input type="text" pattern="[a-zA-Z'-'\s]*">
name validation html
<input type="text" pattern="[a-zA-Z'-'\s]*">
input formatting
1/* Test Formatting Input (TestFormattedInput.cpp) */
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
string areaCode, phoneCode;
string inStr;
cout << "Enter your phone number in this format (xxx)xxx-xxxx : ";
cin.ignore(); // skip '('
cin >> setw(3) >> areaCode;
cin.ignore(); // skip ')'
cin >> setw(3) >> phoneCode;
cin.ignore(); // skip '-'
cin >> setw(4) >> inStr;
phoneCode += inStr;
cout << "Phone number is (" << areaCode << ")"
<< phoneCode.substr(0, 3) << "-"
<< phoneCode.substr(3, 4) << endl;
return 0;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us