{"id":3028,"date":"2026-03-19T08:00:00","date_gmt":"2026-03-19T07:00:00","guid":{"rendered":"https:\/\/www.fuhselab.de\/?p=3028"},"modified":"2026-03-10T07:10:45","modified_gmt":"2026-03-10T06:10:45","slug":"c-textprogramm-version-3","status":"publish","type":"post","link":"https:\/\/www.fuhselab.de\/index.php\/2026\/03\/19\/c-textprogramm-version-3\/","title":{"rendered":"C++ Textprogramm Version 3"},"content":{"rendered":"\n<p><br>Aus Version 2 wird jetzt Version 3. Unser Textprogramm soll jetzt auch den gesamten eingegebenen Text in die externe Textdatei schreiben&#8230;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><strong>Das C++ Textprogramm Version 3:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\n#include &lt;fstream>\n#include &lt;string>\n\nint main()\n{\nstd::ofstream dat_aus;\nstd::string dateiname;\nstd::string texteingabe;\nstd::cout &lt;&lt; \"Geben Sie den Namen der Datei mit Dateiendung (txt) ein: \";\nstd::cin >> dateiname;\nstd::cout &lt;&lt; std::endl;\nstd::cout &lt;&lt; \"Geben Sie den Text f\u00fcr die Datei ein: \";\n\nstd::string zeile;\ngetline(std::cin, zeile);\n\nwhile (getline(std::cin, zeile)) {\ntexteingabe = texteingabe + zeile + '\\n';\nif (zeile == \"\") {\nbreak;\n}\n}\n\ndat_aus.open(dateiname.c_str(), std::ios_base::out);\n\nif(!dat_aus)\n{\nstd::cout &lt;&lt; \"Datei konnte nicht ge\u00f6ffnet werden!\";\nstd::cout &lt;&lt; std::endl;\nreturn -1;\n}\n\n\/\/Daten in die Datei schreiben\ndat_aus &lt;&lt; texteingabe &lt;&lt; std::endl;\ndat_aus.close();\nreturn 0;\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Aus Version 2 wird jetzt Version 3. Unser Textprogramm soll jetzt auch den gesamten eingegebenen Text in die externe Textdatei schreiben&#8230;<\/p>\n","protected":false},"author":1,"featured_media":543,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[32],"class_list":["post-3028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding-club","tag-coding-club-peine"],"_links":{"self":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/comments?post=3028"}],"version-history":[{"count":1,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3028\/revisions"}],"predecessor-version":[{"id":3029,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3028\/revisions\/3029"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media\/543"}],"wp:attachment":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media?parent=3028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/categories?post=3028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/tags?post=3028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}