Zum Inhalt springen

leonardodeku

Mitglieder
  • Gesamte Inhalte

    6
  • Benutzer seit

  • Letzter Besuch

Beiträge von leonardodeku

  1. #include <iostream>
    using namespace std;

    int main()
    {

    int points;

    int rows = 9;

    int cols = 6;
    int Field[rows][cols];

    int N = 45;
    int y;
    int x;

    for (int i = 0; i < rows ; i++){

       for(int j = 0 ; j < cols; j++){ Field[j] = 0;

          } 
    }

    cout << "Wie Viele Punkte wollen Sie: ";
    cin >> points; if(points != N){
    cout << "X und Y eingeben: " << endl;
    for (int i = 1 ; i <= points ; i++){
    cout << "Eingabe " << i << " : ";
    cin >> x >> y;
    while (x > 50 || y > 9)
    {
    cout << "falsche Eingabe\n";
    cout << "Eingabe " << i << " : ";
    cin >> x >> y; }
    if(x % 10 == 0){
    x = x / 10; Field[y][x] = 1;
        }
      }
    cout << endl;
    }
    else{
       cout << "Falsche Eingabe" << endl;
     }
    for(int i = rows; i > 0; i--)
    {   
         cout << i << "|" ;
         for (int j = 0; j < cols; j++){
             if(Field[j] == 1){
       cout << "*"; } cout << " ";
       }
       cout << "\n\n\n"; } cout << "0" << "|";
       for(int j = 1; j < cols; j++)
      {
     cout << "---------" << j;
      }
    }

  2. #include <iostream>

     

    using namespace std;

     

    void getMenu(){

    cout<<"Menu"<<endl;

    cout<<"1 - Anzahl festleegen"<< endl;

    cout<<"2 - Zahlen eingeben" << endl;

    cout<<"3 – Minimum anzeigen"<< endl;

    cout<<"x – Beenden"<< endl;

    }

    void getMenu2(){

    cout<<"a = 1" << endl;

    cout<<"b = 2" << endl;

    cout<<"c = 3" << endl;

     

     

    }

     

    int main()

    {

    int wahl;

    char wahl2;

    int zahl1;

    int zahl2;

    int zahl3;

     

    getMenu();

    cout<<"Ihre Wahl: ";

    cin>> wahl ;

     

    while (wahl != 'x'){

    if(wahl == 1){

    getMenu2();

    cout<<"Antwort: ";

    cin>> wahl2;

    cout<<endl;

    }

    else if(wahl == 2)

    {

    if(wahl2 =='a'){

    cout<<"bitte geben Sie die Zahl ein: ";

    cin>>zahl1;

    break;

     

    }

    else if (wahl2 =='b'){

    cout<<"bitte geben Sie die erste Zahl ein: ";

    cin>>zahl1;

     

    cout<<"bitte geben Sie die zweite Zahl ein: ";

    cin>>zahl2;

     

    cout<<endl;

    }

    else if (wahl2 =='c'){

    cout<<"bitte geben Sie die erste Zahl ein: ";

    cin>>zahl1;

     

    cout<<"bitte geben Sie die zweite Zahl ein: ";

    cin>>zahl2;

     

    cout<<"bitte geben Sie die dritte Zahl ein: ";

    cin>>zahl3;

     

    cout<<endl;

    }

    else{

    cout<<"Nochmal waehlen";

    }

     

    }

    else if(wahl == 3)

    {

    if (wahl2 =='a'){

    cout<<"die kleinste Zahl ist : "<< zahl1 <<endl;

    }

    else if(wahl2 =='b'){

    if (zahl1 < zahl2){

    cout<<"die kleinste Zahl ist: "<< zahl1 <<endl;

    }

    else{

    cout<<"die kleinste Zahl ist: "<< zahl2 <<endl;

    }

    }

    else if(wahl2 =='c'){

    if (zahl1 < zahl2 && zahl1 < zahl3){

    cout<<"die kleinste Zahl ist: "<< zahl1 <<endl;

     

    }

    else if(zahl1 < zahl2 && zahl3 < zahl1){

    cout<<"die kleinste Zahl ist: "<< zahl3 <<endl;

    }

    else{

    cout<<"die kleinste Zahl ist: "<<zahl2 <<endl;

    }

    }

    else{

    cout<<"error"<<endl;

    }

    }

    else{

    cout<<"danke"<<endl;

    break;

    }

    getMenu();

    cout<<"Ihre Wahl: ";

    cin>> wahl;

     

     

     

    }

     

    }

     

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...