-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab_5.cpp
More file actions
34 lines (27 loc) · 862 Bytes
/
Copy pathLab_5.cpp
File metadata and controls
34 lines (27 loc) · 862 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
include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main() {
string email;
getline(cin, email);
int total = email.length();
int upper = 0, lower = 0, digit = 0, other = 0;
for (char c : email) {
if (isupper(c)) {
upper++;
} else if (islower(c)) {
lower++;
} else if (isdigit(c)) {
digit++;
} else {
other++;
}
}
cout << fixed << setprecision(3);
cout << (upper * 100.0 / total) << "%" << endl;
cout << (lower * 100.0 / total) << "%" << endl;
cout << (digit * 100.0 / total) << "%" << endl;
cout << (other * 100.0 / total) << "%" << endl;
return 0;
}