aboutsummaryrefslogtreecommitdiff
path: root/challenge-190/ulrich-rieke/cpp/ch-1.cpp
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2022-11-14 09:29:47 -0500
committerDave Jacoby <jacoby.david@gmail.com>2022-11-14 09:29:47 -0500
commitb43c7c0901bac835315fe78c39db7528e9a9a58d (patch)
treedbe607f12c2ea0a4413a552332c40111b2fbbc80 /challenge-190/ulrich-rieke/cpp/ch-1.cpp
parent2e12c850a19098123c635ccacfa30b69f6ba66dc (diff)
parent377a415bb53d1ed0b16b70d190bb444241216036 (diff)
downloadperlweeklychallenge-club-b43c7c0901bac835315fe78c39db7528e9a9a58d.tar.gz
perlweeklychallenge-club-b43c7c0901bac835315fe78c39db7528e9a9a58d.tar.bz2
perlweeklychallenge-club-b43c7c0901bac835315fe78c39db7528e9a9a58d.zip
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-190/ulrich-rieke/cpp/ch-1.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 ;
+}