From 99ca39a76114417fd989f3480d94edc5ebe681a5 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Thu, 26 Dec 2019 00:33:57 +0100 Subject: Resuelto 438 en c++: Esgritura. --- c/438_esgritura.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 c/438_esgritura.cpp (limited to 'c') 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 + +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; + } + } +} -- cgit v1.2.1