Moin moin,
ich möchte eine Zeichenkette und eine Zahl gleichzeitig vom Benutzer eingeben lassen. Das ganze soll eine Simulation werden. Ich gebe z.B. "speed 450" ein und dann soll die Geschwindigkeit auf 450 gestellt werden.
Ansich hab ich mir gedacht ich les das ganze als string oder char ein suche erst nach dem Befehl z.B. "speed", entferne dann den Befehl und das darauf folgende Lerrzeichen und wandle den Rest, es bleibt ja nur noch die Zahl, mittels atoi() in einen Integer um.
Bis auf das Umwandeln hat ales einwandfrei funktioniert, der Integer hat halt am Ende den Wert 0. Wie kann das sein eigentlich sollte das doch funktionieren?
MfG Inv151673 ;)
was meinst du mit NumberStyles?
None | The integral-digits element only.
AllowDecimalPoint | The decimal point (.) and fractional-digits elements.
AllowExponent | The "e" or "E" character, which indicates exponential notation. This flag by itself supports values in the form digitsEdigits; additional flags are needed to successfully parse strings with such elements as positive or negative signs and decimal point symbols.
AllowLeadingWhite | The ws element at the beginning of s.
AllowTrailingWhite | The ws element at the end of s.
AllowLeadingSign | The sign element at the beginning of s.
AllowTrailingSign | The sign element at the end of s.
AllowParentheses | The sign element in the form of parentheses enclosing the numeric value.
AllowThousands | The thousands separator (,) element.
AllowCurrencySymbol | The currency ($) element.
Currency | All elements. However, s cannot represent a hexadecimal number or a number in exponential notation.
Float | The ws element at the beginning or end of s, sign at the beginning of s, and the decimal point (.) symbol. The s parameter can also use exponential notation.
Number | The ws, sign, thousands separator (,) and decimal point (.) elements.
Any | All elements. However, s cannot represent a hexadecimal number.
das ist die liste der numbersyles. du brauchst none weil es integer sind.