-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrownfox.cpp
More file actions
69 lines (51 loc) · 1.56 KB
/
Copy pathbrownfox.cpp
File metadata and controls
69 lines (51 loc) · 1.56 KB
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
60
61
62
63
64
65
66
67
68
69
#include <bits/stdc++.h>
using namespace std;
int main()
{
int sets;
char alpha[] = "abcdefghijklmnopqrstuvwxyz";
cin >> sets;
cin.ignore(); //ignores until space
// or can use, cin.get(); //consumes the \n
for(int i=0; i<sets; i++){
string phrase;
int len;
bool f_missing = false;
getline(cin,phrase);
transform(phrase.begin(), phrase.end(), phrase.begin(), ::tolower); //all to lowercase
len = phrase.length(); //count length of string
//len1 = alpha.length();
//or use this
// phrase.size();
int sum = 0;
for(int k=0; k<26; k++){ //alpha
int found = 0;
int chart;
chart = alpha[k] - 48;
for(int j=0; j<len; j++){ //phrase
int value;
value = phrase[j] - 48;
if (chart == value){
found = 1;
sum++;
break;
}
} //end of 3rd for loop
if (found == 0){ //if found remains 0 after checking
if(f_missing == false){
cout << "missing " << alpha[k];
f_missing = true;
}
else{
cout << alpha[k];
}
}
} //end of for 2nd loop
if (sum == 26){
cout << "pangram" <<endl;
}
else //for those without pangram, their sum will != 26. and then endl
cout <<endl;
} //end of 1st for loop
return 0;
}