Autor Beitrag
g-hun
Hält's aus hier
Beiträge: 12

Win XP
Delphi
BeitragVerfasst: Do 01.03.07 18:21 
Hallo!

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
using System;

public class Test   
{
    public static void Main(string[] args)
    {
        Console.Write("Gib eine Zahl ein: ");
        int Eingabe;
        Eingabe=Console.Read();
        Console.WriteLine("Deine Eingabe: " + Eingabe);
        Console.ReadKey();
    }
}


[url=www.bilder-hosting.de/show/9NB7C.html]user defined image[/URL]

Da stellt sich jedoch die Frage:
Wieso wird 49 angezeigt. Muss man da was Konvertieren??
:?:


Moderiert von user profile iconChristian S.: Topic aus Allgemeine .NET-Fragen verschoben am Do 01.03.2007 um 17:25
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Do 01.03.07 19:10 
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
public class Test   
{
    public static void Main(string[] args)
    {
        Console.Write("Gib eine Zahl ein: ");
        int Eingabe;
        Eingabe=Console.Read();
        Console.WriteLine("Deine Eingabe: " + ToString(Eingabe));
        Console.ReadKey();
    }
}


So muss man zumindest bei Winforms umwandeln

EDIT: Ich sehe gerade das es nicht funktioniert

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 01.03.07 19:32 
Du meinst sicherlich Eingabe.ToString() ;-)

Und ob WinForms oder nicht, das hat damit nix zu tun. Die Sprache ist dieselbe :)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
g-hun Threadstarter
Hält's aus hier
Beiträge: 12

Win XP
Delphi
BeitragVerfasst: Do 01.03.07 19:43 
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
using System;

public class Test
{
    public static void Main(string[] args)
    {
        Console.Write("Gib eine Zahl ein: ");
        int Eingabe;
        Eingabe = Console.Read();
        Console.WriteLine("Deine Eingabe: " + Eingabe.ToString());
        Console.ReadKey();
    }
}


Das ist das selbe. Es funktioniert wirklich nicht, ich verstehe es auch nicht.
r2c2
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 324
Erhaltene Danke: 2

Linux

BeitragVerfasst: Do 01.03.07 20:38 
Ascii('1') = 49

klingelts? Read liest das nächste *Zeichen* ein...

mfg

Christian

_________________
Kaum macht man's richtig, schon klappts!
g-hun Threadstarter
Hält's aus hier
Beiträge: 12

Win XP
Delphi
BeitragVerfasst: Fr 02.03.07 17:02 
wenn ich readline einsetze kriege ich folgende fehlermeldung:

ausblenden Quelltext
1:
Fehler  1  Eine implizite Konvertierung vom Typ "string" in "int" ist nicht möglich.  C:\Dokumente und Einstellungen\Cihan\Eigene Dateien\Visual Studio 2005\Projects\Project1\Project1\CodeFile1.cs  9  19  Project1					
r2c2
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 324
Erhaltene Danke: 2

Linux

BeitragVerfasst: Fr 02.03.07 19:38 
Dann musst du eben konvertieren... Guck dir mal System.Convert an...

mfg

Christian

_________________
Kaum macht man's richtig, schon klappts!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 02.03.07 19:53 
Oder Int32.Parse oder Int32.TryParse

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
g-hun Threadstarter
Hält's aus hier
Beiträge: 12

Win XP
Delphi
BeitragVerfasst: Sa 03.03.07 12:34 
könntet ihr nicht einfach den ganzen quellcode
umändern, wie es sein sollte und hier posten.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 03.03.07 12:39 
Nö. Versuch das selbst und zeig, wo Du nicht weiter kommst. Wie willst Du denn lernen, Probleme selber zu lösen, wenn Du andere Dein Zeug machen lässt?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".