54 lines
826 B
C++
54 lines
826 B
C++
/*
|
|
Nome: Mario
|
|
Cognome: Montanari
|
|
|
|
isPangram
|
|
*/
|
|
|
|
#include <iostream>
|
|
#include <cstring>
|
|
#include <cctype>
|
|
|
|
#define SIZE 100+1
|
|
|
|
using namespace std;
|
|
|
|
bool isPangram(char *src1);
|
|
|
|
int main(void) {
|
|
char src1[SIZE];
|
|
|
|
cout << "Prima frase: ";
|
|
cin.getline(src1, SIZE);
|
|
|
|
if (isPangram(src1)) {
|
|
cout << "La fare e' un Pangramma." << endl;
|
|
} else {
|
|
cout << "La frase non e' un pangramma." << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
bool isPangram(char *src1) {
|
|
for (int i = 0; i < strlen(src1); i++) {
|
|
src1[i] = tolower(src1[i]);
|
|
}
|
|
|
|
for (char ch = 'a'; ch <= 'z'; ch++) {
|
|
bool letterFound = false;
|
|
|
|
for (int i = 0; i < strlen(src1); i++) {
|
|
if (src1[i] == ch) {
|
|
letterFound = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!letterFound) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
} |