Guest User

Untitled

a guest
Sep 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main ()
  8. {
  9. string inhalt;
  10. string weiter = "j";
  11. string auswahl;
  12. fstream f;
  13.  
  14.  
  15. while (weiter == "j")
  16. {
  17. cout << "M\224chten Sie die vorhandenen Eintr\204ge anzeigen "
  18. << "lassen oder einen neuen Kunden hinzuf\201gen? "
  19. << "(anzeigen:a, hinzuf\201gen: h)" << endl;
  20. getline (cin, auswahl);
  21.  
  22. if (auswahl == "h")
  23. {
  24. f.open("kunden.txt", ios::app);
  25. cout << "Kundennummer: ";
  26. getline (cin, inhalt);
  27. inhalt += "\n";
  28. f << inhalt;
  29. cout << "Vorname: ";
  30. getline (cin, inhalt);
  31. inhalt += "\n";
  32. f << inhalt;
  33. cout << "Nachname: ";
  34. getline (cin, inhalt);
  35. inhalt += "\n";
  36. f << inhalt;
  37. cout << "Telefonnnummer: ";
  38. getline (cin, inhalt);
  39. inhalt += "\n";
  40. f << inhalt;
  41. inhalt = "\n";
  42. f << inhalt;
  43. f.close();
  44. }
  45.  
  46. else if (auswahl == "a")
  47. {
  48. f.open("kunden.txt", ios::in);
  49. while(!f.eof())
  50. {
  51. getline (f, inhalt);
  52. cout << inhalt << endl;
  53. }
  54. f.close();
  55. }
  56.  
  57. else
  58. {
  59. cout << "Ung\201ltige Eingabe!" << endl;
  60. }
  61.  
  62. cout << "M\224chten Sie eine weitere Aktion durchf\201hren? (j/n) ";
  63. getline (cin, weiter);
  64. }
  65. }
Add Comment
Please, Sign In to add comment