From 5cff617b2aa2148773256eed1a00607e0189529b Mon Sep 17 00:00:00 2001 From: Oskar Date: Thu, 29 Aug 2024 15:56:24 +0200 Subject: 5.12 was a pain to figure out, its not very pretty i will admit --- 5p10.cpp | 42 ++++++++++++++++++++++++++++++++ 5p11.cpp | 54 +++++++++++++++++++++++++++++++++++++++++ 5p12.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5p13.cpp | 12 ++++++++++ 5p9.cpp | 42 ++++++++++++++++++++++++++++++++ 5 files changed, 234 insertions(+) create mode 100644 5p10.cpp create mode 100644 5p11.cpp create mode 100644 5p12.cpp create mode 100644 5p13.cpp create mode 100644 5p9.cpp diff --git a/5p10.cpp b/5p10.cpp new file mode 100644 index 0000000..27c8a71 --- /dev/null +++ b/5p10.cpp @@ -0,0 +1,42 @@ +#include + +/* + * + * 5.10 + * + * Same as 5.9 because i already considered capital letters + */ + +int main () { + + char Character = 0; + int Va = 0; + int Ve = 0; + int Vi = 0; + int Vo = 0; + int Vu = 0; + int NonVowel = 0; + while(std::cin >> Character) { + if(Character == 'a' || Character == 'A') { + ++Va; + } else if (Character == 'e' || Character == 'E') { + ++Ve; + } else if (Character == 'i' || Character == 'I') { + ++Vi; + } else if (Character == 'o' || Character == 'O') { + ++Vo; + } else if (Character == 'u' || Character == 'U') { + ++Vu; + } else { + ++NonVowel; + } + } + + std::cout << "A: " << Va << "\n" + << "E: " << Ve << "\n" + << "I: " << Vi << "\n" + << "O: " << Vo << "\n" + << "U: " << Vu << "\n" + << "Non Vowel: " << NonVowel << std::endl; + return 0; +} diff --git a/5p11.cpp b/5p11.cpp new file mode 100644 index 0000000..460e0e8 --- /dev/null +++ b/5p11.cpp @@ -0,0 +1,54 @@ +#include + +/* + * + * 5.11 + * + * + */ + +int main () { + + char Character = 0; + uint32_t Va = 0; + uint32_t Ve = 0; + uint32_t Vi = 0; + uint32_t Vo = 0; + uint32_t Vu = 0; + uint32_t BlankSpace = 0; + uint32_t Tabs = 0; + uint32_t Newlines = 0; + uint32_t Other = 0; + while(std::cin.get(Character)) { + if(Character == 'a' || Character == 'A') { + ++Va; + } else if (Character == 'e' || Character == 'E') { + ++Ve; + } else if (Character == 'i' || Character == 'I') { + ++Vi; + } else if (Character == 'o' || Character == 'O') { + ++Vo; + } else if (Character == 'u' || Character == 'U') { + ++Vu; + } else if (Character == '\n') { + ++Newlines; + } else if (Character == '\t') { + ++Tabs; + } else if (Character == ' ') { + ++BlankSpace; + } else { + ++Other; + } + } + + std::cout << "A: " << Va << "\n" + << "E: " << Ve << "\n" + << "I: " << Vi << "\n" + << "O: " << Vo << "\n" + << "U: " << Vu << "\n" + << "Tabs: " << Tabs << "\n" + << "Newlines: " << Newlines << "\n" + << "Blank Space: " << BlankSpace << "\n" + << "Others: " << Other << std::endl; + return 0; +} diff --git a/5p12.cpp b/5p12.cpp new file mode 100644 index 0000000..c9c6117 --- /dev/null +++ b/5p12.cpp @@ -0,0 +1,84 @@ +#include + +/* + * + * 5.12 + * + * + */ + +int main () { + + char Character = 0; + uint32_t Va = 0; + uint32_t Ve = 0; + uint32_t Vi = 0; + uint32_t Vo = 0; + uint32_t Vu = 0; + uint32_t BlankSpace = 0; + uint32_t Tabs = 0; + uint32_t Newlines = 0; + uint32_t Other = 0; + uint32_t ffflfi = 0; + bool factive = false; + while(std::cin.get(Character)) { + if(Character == 'a' || Character == 'A') { + ++Va; + factive = false; + } else if (Character == 'e' || Character == 'E') { + ++Ve; + factive = false; + } else if (Character == 'i' || Character == 'I') { + if(factive) { + ++ffflfi; + factive = false; + } + + ++Vi; + } else if (Character == 'o' || Character == 'O') { + ++Vo; + factive = false; + } else if (Character == 'u' || Character == 'U') { + ++Vu; + factive = false; + } else if (Character == 'f') { + if(factive) { + ++ffflfi; + factive = false; + continue; + } + + factive = true; + } else if (Character == 'l') { + if(factive) { + ++ffflfi; + factive = false; + } + + } else if (Character == '\n') { + ++Newlines; + factive = false; + } else if (Character == '\t') { + ++Tabs; + factive = false; + } else if (Character == ' ') { + ++BlankSpace; + factive = false; + } else { + ++Other; + factive = false; + } + } + + std::cout << "A: " << Va << "\n" + << "E: " << Ve << "\n" + << "I: " << Vi << "\n" + << "O: " << Vo << "\n" + << "U: " << Vu << "\n" + << "Tabs: " << Tabs << "\n" + << "Newlines: " << Newlines << "\n" + << "Blank Space: " << BlankSpace << "\n" + << "ffflfi: " << ffflfi << "\n" + << "Others: " << Other << std::endl; + return 0; +} diff --git a/5p13.cpp b/5p13.cpp new file mode 100644 index 0000000..58d5fbf --- /dev/null +++ b/5p13.cpp @@ -0,0 +1,12 @@ +#include + +/* + * + * Description + * + * + */ + +int main () { + return 0; +} diff --git a/5p9.cpp b/5p9.cpp new file mode 100644 index 0000000..ea3f054 --- /dev/null +++ b/5p9.cpp @@ -0,0 +1,42 @@ +#include + +/* + * + * 5.9 + * + * + */ + +int main () { + + char Character = 0; + int Va = 0; + int Ve = 0; + int Vi = 0; + int Vo = 0; + int Vu = 0; + int NonVowel = 0; + while(std::cin >> Character) { + if(Character == 'a' || Character == 'A') { + ++Va; + } else if (Character == 'e' || Character == 'E') { + ++Ve; + } else if (Character == 'i' || Character == 'I') { + ++Vi; + } else if (Character == 'o' || Character == 'O') { + ++Vo; + } else if (Character == 'u' || Character == 'U') { + ++Vu; + } else { + ++NonVowel; + } + } + + std::cout << "A: " << Va << "\n" + << "E: " << Ve << "\n" + << "I: " << Vi << "\n" + << "O: " << Vo << "\n" + << "U: " << Vu << "\n" + << "Non Vowel: " << NonVowel << std::endl; + return 0; +} -- cgit v1.2.3