Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main ()
- {
- string inhalt;
- string weiter = "j";
- string auswahl;
- fstream f;
- while (weiter == "j")
- {
- cout << "M\224chten Sie die vorhandenen Eintr\204ge anzeigen "
- << "lassen oder einen neuen Kunden hinzuf\201gen? "
- << "(anzeigen:a, hinzuf\201gen: h)" << endl;
- getline (cin, auswahl);
- if (auswahl == "h")
- {
- f.open("kunden.txt", ios::app);
- cout << "Kundennummer: ";
- getline (cin, inhalt);
- inhalt += "\n";
- f << inhalt;
- cout << "Vorname: ";
- getline (cin, inhalt);
- inhalt += "\n";
- f << inhalt;
- cout << "Nachname: ";
- getline (cin, inhalt);
- inhalt += "\n";
- f << inhalt;
- cout << "Telefonnnummer: ";
- getline (cin, inhalt);
- inhalt += "\n";
- f << inhalt;
- inhalt = "\n";
- f << inhalt;
- f.close();
- }
- else if (auswahl == "a")
- {
- f.open("kunden.txt", ios::in);
- while(!f.eof())
- {
- getline (f, inhalt);
- cout << inhalt << endl;
- }
- f.close();
- }
- else
- {
- cout << "Ung\201ltige Eingabe!" << endl;
- }
- cout << "M\224chten Sie eine weitere Aktion durchf\201hren? (j/n) ";
- getline (cin, weiter);
- }
- }
Add Comment
Please, Sign In to add comment