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.

Tastaturpuffer löschen

Empfohlene Antworten

Veröffentlicht

Hi C++ Cracks!

Ich habe zwei Funtionen, die Werte einlesen. Nach dem ich die erste Eingabe mit ENTER abgeschlossen habe, wird die darauffolgende Eingabefunktion gar nicht aufgerufen.

In der Ausgabe der letzteren Funktion steht dann auch nichts drin.

Wenn ich die erste Funktion lösche, funktioniert die zweite einwandfrei.

Codeauszug:

void Daten::SetPlz()

{

int p=0;

cout<<"Bitte PLZ eingeben: ";

cin>>plz;

if(p <10000 || p > 99999)

{

while(p <10000 || p > 99999)

{

cout<<"\nFEHLER !!! Falsche PLZ!\n";

cout<<"Bitte neu eingeben: ";

cin>>p;

}

plz = p;

}

plz = p;

}

int Daten::GetPlz()

{

return plz;

}

void Daten::SetOrt() // Diese Funktion rasselt durch

{

cout<<"Bitte Ort eingeben: ";

cin.getline(ort,19);

}

string Daten::GetOrt()

{

return ort; // hier wird nichts zurückgegeben

}

Für ein detailiertes Beispiel und/oder Erklärung wäre ich sehr dankbar.

für cin gibt es die methode ignore (), d.h. nach cin >> p; ein cin.ignore ();

dadurch wird das return, das mit cin >> p; nicht aus dem puffer entfernt wurde, eliminiert.

ansonsten wird das return sofort in der zweiten funktion verwendet und somit ist eine eingabe nicht mehr möglich. :eek:

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.