Skip to content

Instantly share code, notes, and snippets.

@r4nx
Created April 3, 2020 14:11
Show Gist options
  • Select an option

  • Save r4nx/c52de53d723f1d8dea1d28f4beb173b4 to your computer and use it in GitHub Desktop.

Select an option

Save r4nx/c52de53d723f1d8dea1d28f4beb173b4 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <cctype>
using namespace std;
int main()
{
string sentence;
getline(cin, sentence);
array<bool, 26> presence;
for (auto c : sentence) {
c = toupper(c);
if (c < 'A' || c > 'Z')
continue;
presence[c - 'A'] = true;
}
cout << "The sentence is "
<< (all_of(
presence.cbegin(),
presence.cend(),
[](bool x) { return x; }) ? "" : "not ")
<< "a panagram."
<< endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment