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.

Prozentzahlen- Kommazahlen

Empfohlene Antworten

Veröffentlicht

hi Freaks,

wäre klasse, wenn ihr euch mal das Programm anschauen könntet.

Ich kann damit keine Fließkommazahlen anzeigen, woran liegt das???

//

//

// Programm zum Berechnen eines Betrags

#include <iostream.h>

#include <conio.h>

int main(int argc, char* argv[])

{

//Standard Variablen

double eingabeWert = 0;

double prozentsatzfunktion= 0;

double prozentsatz = 0;

//wichtige if-/ else- Variablen

int wertBerechnung = 0;

//wichtige Informationen

cout << "Dieses Programm soll den Prozentsatz berechnen." << endl;

//Infos zum Programm

cout << "Bitte geben sie zuerst den Wert ein, der bearbeitet werden soll." << endl;

cout << "Bitte geben sie dann den Prozentsatz ein." << endl;

cout << endl;

// Eingabe der Daten

cout << "Bitte geben sie den Wert ein: ";

cout << endl;

cin >> eingabeWert;

cout << "Ihr Wert betraegt: " << eingabeWert <<endl;

cout << endl;

cout << "Bitte geben sie nun den Prozentsatz an. " << endl;

cin >> prozentsatz;

cout << "Ihr Prozentsatz betraegt " << prozentsatz << " ." << endl;

cout << endl;

//if-/ else- Funktion (Eingabe)

cout << "Bitte geben sie nun an, ob sie den Prozentsatz addieren/subtr. wollen.";

cout << endl;

cout << "Fuer add.: 1 " ;

cout << endl;

cout << "Fuer subtr.: 2 ";

cout << endl << endl;

cin >> prozentsatzfunktion;

cout << endl;

// if-/ else- Funktion

if (prozentsatzfunktion == 1)

{

cout << "Der Wert wird nun berechnet... " << endl;

wertBerechnung = eingabeWert + ((prozentsatz / 100.0) * eingabeWert);

cout << "Der Wert ist " << wertBerechnung << " ." << endl;

getch();

return 0;

}

if (prozentsatzfunktion == 2)

{

cout << "Der Wert wird nun berechnet... " << endl;

wertBerechnung = eingabeWert - ((prozentsatz / 100.0) * eingabeWert) ;

cout << "Der Wert ist " << wertBerechnung << " ." << endl;

}

else

{

cout << "Sie muessen 1 bzw. 2 eingeben, damit das Programm arbeiten kann.";

getch();

return 0;

}

getch();

return 0;

}

THX a lot,

Hardware- Georg :D

funzt schon wieder- musste nur statt integer einen double Wert verwenden!!!!!!!!!

CU,

Hardware- Georg

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.