Git Product home page Git Product logo

uebung-044's Introduction

Uebung-044 -- Vocal Filter

📎Angabe .pdf

📊 Lernziele:

  • ↳ Strings

🧮 Aufgabenstellung:

  • Das Programm extrahiert aus dem eingegebenen Text alle Vokale (Groß/Kleinschreibung ist egal).
  • Als Vokale sind nur a,e,i,o,u und A,E,I,O,U zu berücksichtigen.
  • Kommt ein Vokal mehrfach vor, ist nur das erste Vorkommen zu verwenden.

Orientieren Sie sich bei der Ausgabe an der Musterausgabe!


🔎 Ausgabe Bsp.

Musterausgabe
Ausgabebeispiel 📎

Testbeispiele
Testbeispiele: 📎

SPOILER Lösung :

🖥 Ausgabe:

Meine Ausgabe
Ausgabe 📎

💾 C# - Programm:

👉 ausklappen 👈
namespace FilterVocals      //  
{                           //
 public class Program      //
 {                         //
   static void Main()      //
   {
     ///*----------------------- console_settings ------------------------*///
     const int cWidth = 53;                     //  console width
     const int cHeight = 30;                    //  & height
     Console.SetWindowSize(cWidth, cHeight);    //
     Console.OutputEncoding = Encoding.UTF8;    //  Unicode Symbols

     /*----------------------------- VARIABLES -----------------------------*/
     string userInput,                       //  
            vocalCache = "",
            vocalCacheOut = "";
     char[] vocalLower = new char[5];
     vocalLower = ['a', 'e', 'i', 'o', 'u'];
     char[] vocalUpper = new char[5];
     vocalUpper = ['A', 'E', 'I', 'O', 'U'];

     int index;
     bool empty;

     /*-------------------------------- HEAD -------------------------------*/
     Console.Clear();
     Console.Write("\n             Vokale aus Text extrahieren             " +
     /* cWidth: */ "\n=====================================================");

     Console.Write("\n Text: ");
     userInput = Console.ReadLine();

     empty = (userInput.Length > 0) ? true : false;
     if (empty)
     {
       for (index = 0; index < userInput.Length; index++)
       {
         for (int i = 0; i < 5; i++)
         {
           if (userInput[index] == vocalLower[i] || userInput[index] == vocalUpper[i])
           {
             vocalCache = vocalCache + userInput[index];
             vocalLower[i] = ' ';
             vocalUpper[i] = ' ';
           }
         }
       }
       int length = vocalCache.Length;
       for (index = 0; length > index; index++)
       {
         if (vocalCache[index] != ' ')
         {
           vocalCacheOut = vocalCacheOut + vocalCache[index];
         }
       }
     }
     else
     { Console.Write("\n"); }

     Console.Write($"\n Der Text \"{userInput}\" enthält {vocalCacheOut.Length} Vokale: {vocalCacheOut}");

     /*-------------------------------- END --------------------------------*/
     Console.Write("\n Zum beenden Eingabetaste drücken..");
     Console.ReadLine();    //  wait for [enter]
     Console.Clear();       //
   }
 }
}

uebung-044's People

Contributors

ixi-enki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.