-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (25 loc) · 772 Bytes
/
main.cpp
File metadata and controls
46 lines (25 loc) · 772 Bytes
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
//main.cpp - Email Validation Program main entry point
//Written by Gabe Harms
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//Validates email and retruns true if the email is valdi, returns zero otherwise
bool IsValid( string email);
void main() {
// 1. Open input and output files
ifstream input("Email.txt");
ofstream output("Result.txt");
// 2. While not at the end of the input file
while ( !input.eof() )
{
string email;
// 3. Read an email address from the input file
input >> email;
// 4. Validate the email address
bool isValid = IsValid(email);
// 5. If the email address is valid write 1 to the output file else write zero
output << isValid << endl;
// 6. Repeat
system("pause");
}