Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo liebe Freunde.

Ich schreibe gerade ein Kassierprogramm in C++ .NET und dort werden auch Zahlen zur Abrechung abgegeben.

Leider sieht dass etwas doof aus, wenn der Kunde "7,3" Euro zurück bekommt oder die Cola "0,4" Euro kostet.

Ich kann mir vorstellen, dass es eine Simple funktion gibt, aus "7" "7,00" oder aus "4,2" "4,20" zu machen. Leider kenn ich keine.

Man hat mir Round empfohlen, aber ich kann damit wenig anfangen.

Vielen Dank im Vorraus

Liebe Grüße

errox

C#


            double d = 7.0;

            MessageBox.Show(d.ToString("F"));

            d = 4.2;

            MessageBox.Show(d.ToString("F"));

Und wie geht das mit 3 Stellen nach dem Komma?

Gruß Kati82

P.S.: Nutze C++/ CLI

Danke. Habs über CultureInfo und NumberFormatInfo hinbekommen. Finde das allerdings blöd, dass man diesen Weg über die CultureInfo gehen muss.

Ok, warum kompliziert, wenns auch einfach geht. :upps

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.