我制作了一个 C++ 程序来检查一个句子中是否包含所有字母。但是每次我运行它时,它都显示它是一个 pangram。你能帮我找出问题所在吗?
#include <iostream>
using namespace std;
void pangram() // The function to find if pangram or not.
{
int c;
char alphabet[26]; // 26 is all the letters in the alphabet
for (c = 0; c < 26; c++) { // Checks all the letters
cin >> alphabet[c];
if ((alphabet[c] >= 97 && alphabet[c] <= 122) || ((alphabet[c] >= 65 && alphabet[c] <= 91))) { // alphabet[i] compares to range of characters a - z in ASCII TABLE
cout << "pangram" << endl;
break; // If its pangram, the program stops here.
}
else { // It continues if it's not pangram.
cout << "Not pangram" << endl;
break;
}
}
}
int main() // Main body just to call the pangram function.
{
pangram();
return 0;
}