Autor Beitrag
CanPolat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 30.04.09 19:25 
wo muss ich den befehl "while (true);" genau eingeben? oder muss ich zusäzlich noch was eingeben?

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            double a;
            double b;
            double c;
            

            Console.Write("Gib bitte die erste zahl ein: ");
            a = Convert.ToDouble(Console.ReadLine());
            Console.Write("Gib bitte die zweite zahl ein: ");
            b = Convert.ToDouble(Console.ReadLine());
            Console.Write("Gib bitte die dritte zahl ein: ");
            c = Convert.ToDouble(Console.ReadLine());

            if ((a < b)&&(a<c))
            {
                Console.WriteLine("die kleinste zahl ist {0}",a);
            }
            else
            {
                if ((b < a)&&(b<c))
                {
                    Console.WriteLine("die kleinste zahl ist {0}",b);
                }
                else
                {
                    if ((c < a) && (c < b))
                    {
                        Console.WriteLine("die kleinste zahl ist {0}", c);
                    }
                    else
                    {
                        if ((a == b) && (a == b))
                        {
                            Console.WriteLine("es wurde drei mal die zahl {0} eingegeben", a);
                        }
                        else
                        {
                            if ((a == b) && (a < c))
                            {
                                Console.WriteLine("zahl eins und zwei sind gleich({0}) und die sind jewals kleiner als zahl drei", a);
                            }
                            else
                            {
                                if ((a == b) && (a > c))
                                {
                                    Console.WriteLine("zahl eins und zwei sind gleich({0}) und die sind jewals größer als zahl drei", a);
                                }
                                else
                                {
                                    if ((a == c) && (a < b))
                                    {
                                        Console.WriteLine("zahl eins und drei sind gleich({0}) und die sind jewals kleiner als zahl zwei", a);
                                    }
                                    else
                                    {
                                        if ((a == c) && (a > b))
                                        {
                                            Console.WriteLine("zahl eins und drei sind gleich({0}) und die sind jewals größer als zahl zwei", a);
                                        }
                                        else
                                        {
                                            if ((b == c) && (b < a))
                                            {
                                                Console.WriteLine("zahl zwei und drei sind gleich({0}) und die sind jewals kleiner als zahl eins", b);
                                            }
                                            else
                                            {
                                                if ((b == c) && (b > a))
                                                {
                                                    Console.WriteLine("zahl zwei und drei sind gleich({0}) und die sind jewals größer als zahl eins", b);
                                                }
                                                else
                                                {
                                                    Console.WriteLine("Fatal Error");
                                                    Console.WriteLine("Du bekommst ja nichts auf die reihe du N00B");
                                                    Console.WriteLine("Probiere es nochmal ;)");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                




            }
            Console.Read();
        
        
        }
    }
}
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19313
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 30.04.09 19:28 
Naja, alles was erneut ausgeführt werden soll muss auch in die Schleife.

Zudem darfst du nicht vergessen eine Möglichkeit zum Abbruch einzubauen, was du z.B. mit einer boolschen Variable erreichen kannst. Dann dürfte die Schleife nur laufen solange diese den entsprechenden Wert hat.
CanPolat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 30.04.09 19:33 
danke für die schnelle antwort aber da ich erst heute mit dem programm angefangen habe versteh ich gerade nur bahnhof>.<... könntest du es mir vill einzeichen/schreiben in mein programm?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19313
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 30.04.09 20:02 
Ein Beispiel (ungetestet):
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
        static void Main(string[] args)
        {
            Boolean RepeatAgain = true;
            while (RepeatAgain)
            {
                // Eingaben verarbeiten
                Console.WriteLine("Gib eine Zahl oder etwas anderes ein:");
                Double Value;
                if (Double.TryParse(Console.ReadLine(), out Value))
                    Console.WriteLine("Es wurde die Zahl " + Value.ToString() + " eingegeben!");
                else
                    Console.WriteLine("Es wurde keine gültige Zahl eingegeben!");
                Console.WriteLine("");

                // Wiederholen?
                Console.WriteLine("Programm wiederholen? (j/n): ");
                RepeatAgain = Console.ReadLine().Equals("j");
                Console.WriteLine("");
            }
        }
CanPolat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 30.04.09 23:12 
danke dir.
dabei habe ich sogar die Double.TryParse funktion gelernt xP