aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-12-26 00:33:57 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-12-26 00:33:57 +0100
commit99ca39a76114417fd989f3480d94edc5ebe681a5 (patch)
treee69d3be043b7a4826dbef62c5dd1b2a6718af05e /c
parenta3b244cb98c455c2c88ee17b8424fa6fa8cf805d (diff)
downloadAceptaElReto-99ca39a76114417fd989f3480d94edc5ebe681a5.tar.gz
AceptaElReto-99ca39a76114417fd989f3480d94edc5ebe681a5.zip
Resuelto 438 en c++: Esgritura.
Diffstat (limited to 'c')
-rw-r--r--c/438_esgritura.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/c/438_esgritura.cpp b/c/438_esgritura.cpp
new file mode 100644
index 0000000..c9804d0
--- /dev/null
+++ b/c/438_esgritura.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+
+int esLetra(char letra) {
+ if (letra >= 'a' && letra <= 'z') {
+ return 1;
+ }
+ if (letra >= 'A' && letra <= 'Z') {
+ return 1;
+ }
+ return 0;
+}
+
+int main() {
+ std::string input = "";
+ int letras, excs;
+ //while (std::cin >> input && !std::cin.eof()) {
+ while (std::getline(std::cin, input)) {
+ letras = 0;
+ excs = 0;
+ for (char letra : input) {
+ if (esLetra(letra)) {
+ letras++;
+ }
+ if (letra == '!') {
+ excs++;
+ }
+ }
+ if (excs > letras) {
+ std::cout << "ESGRITO" << std::endl;
+ }
+ else {
+ std::cout << "escrito" << std::endl;
+ }
+ }
+}