C# :: Aufgabe #1 :: Lösung #31
69 Lösungen
#1
Erfolgreiche Eingabe einer Integer - Zahl
Anfänger - C#
von Gustl
- 27.07.2012 um 15:08 Uhr
Erstelle eine Konsolenanwendung in der Benutzer so lange aufgefordert wird, eine ganze Integer - Zahl einzugeben, bis dies erfolgreich war.
#31
von c0da (60 Punkte)
- 28.12.2015 um 03:07 Uhr
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aufg01
{
class Program
{
static void Main(string[] args)
{
bool isInt = false;
int compare;
while (!isInt)
{
isInt = int.TryParse(Console.ReadLine(), out compare);
if (isInt) Console.WriteLine("Die Eingabe entspricht eine Integer Ganzzahl! Das Programm wird beendet!");
else Console.WriteLine("Die Eingabe entspricht keiner Integer Ganzzahl!");
}
}
}
}
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1
