aboutsummaryrefslogtreecommitdiff
path: root/challenge-190/ulrich-rieke/cpp
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-11-09 20:22:05 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-11-09 20:22:05 +0000
commit2b107c0a1007dc904822ac1a2c19d76d697fc559 (patch)
treed2b5d1fb9f5053732d55451a2285bcf08e7fe2fb /challenge-190/ulrich-rieke/cpp
parent142bc3da93a0bc254e064d2c994147c760524b8e (diff)
downloadperlweeklychallenge-club-2b107c0a1007dc904822ac1a2c19d76d697fc559.tar.gz
perlweeklychallenge-club-2b107c0a1007dc904822ac1a2c19d76d697fc559.tar.bz2
perlweeklychallenge-club-2b107c0a1007dc904822ac1a2c19d76d697fc559.zip
- Added solutions by Ulrich Rieke.
Diffstat (limited to 'challenge-190/ulrich-rieke/cpp')
-rw-r--r--challenge-190/ulrich-rieke/cpp/ch-1.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-190/ulrich-rieke/cpp/ch-1.cpp b/challenge-190/ulrich-rieke/cpp/ch-1.cpp
new file mode 100644
index 0000000000..c013223bfe
--- /dev/null
+++ b/challenge-190/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include <string>
+#include <cctype>
+#include <algorithm>
+
+int main( ) {
+ std::cout << "Please enter a word!\n" ;
+ std::string line ;
+ std::cin >> line ;
+ if ( (std::isupper( static_cast<int>( line[0] )) &&
+ std::all_of( line.begin( ) + 1 , line.end( ) , []( char c )
+ {return std::islower( static_cast<int>( c )) ; } )) ||
+ std::all_of( line.begin( ) , line.end( ) , []( char c )
+ { return std::isupper( static_cast<int>( c )) ; }) ||
+ std::all_of( line.begin( ) , line.end( ) , []( char c )
+ { return std::islower( static_cast<int>( c )) ; }) )
+ std::cout << 1 ;
+ else
+ std::cout << 0 ;
+ std::cout << std::endl ;
+ return 0 ;
+}