{"id":1140,"date":"2019-05-03T19:28:58","date_gmt":"2019-05-03T19:28:58","guid":{"rendered":"https:\/\/yazilimperver.com\/?p=1140"},"modified":"2019-06-24T20:28:58","modified_gmt":"2019-06-24T20:28:58","slug":"haftalik-c-15-girdi-cikti-manipulatorleri","status":"publish","type":"post","link":"https:\/\/yazilimperver.com\/index.php\/2019\/05\/03\/haftalik-c-15-girdi-cikti-manipulatorleri\/","title":{"rendered":"[:tr]Haftal\u0131k C++ 15 \u2013 Girdi\/\u00c7\u0131kt\u0131 Manip\u00fclat\u00f6rleri[:en]Weekly C++ 15 \u2013 I\/O Manipulators[:]"},"content":{"rendered":"<p>[:tr]Programlar\u0131m\u0131zda, \u00f6zellikle k\u00fc\u00e7\u00fck olanlarda ya da baz\u0131 de\u011ferleri h\u0131zl\u0131ca g\u00f6r\u00fcnt\u00fclemek i\u00e7in, en s\u0131k kulland\u0131\u011f\u0131m\u0131z y\u00f6ntemlerden birisi de standart \u00e7\u0131kt\u0131ya bir \u015feyler basmakt\u0131r.<br \/>\nBunun i\u00e7in de kullan\u0131lan en yayg\u0131n y\u00f6ntem, C++ i\u00e7in, <em>std::cout<\/em>&#8216;t\u0131r muhtemelen. Peki bu karde\u015fimizin kabiliyetlerine ne kadar vak\u0131f\u0131z? \u0130\u015fte bu yaz\u0131mda bu karde\u015fimize ili\u015fkin yetenekler ile sizleri bulu\u015fturaca\u011f\u0131m.<br \/>\n\u00d6ncelikli olarak standart \u00e7\u0131kt\u0131ya bast\u0131klar\u0131n\u0131z\u0131 kontrol etmenize yarayan yap\u0131lara &#8220;I\/O manipulator&#8221; denilmekte, biz bunlara Girdi\/\u00c7\u0131kt\u0131 Manip\u00fclat\u00f6rleri diyece\u011fiz. Bunlar\u0131 kullanabilmek i\u00e7in &#8220;#include &lt;iomanip&gt;&#8221; ba\u015fl\u0131k dosyas\u0131n\u0131 kodunuzun i\u00e7erisine eklememiz gerekiyor. Bu manip\u00fclat\u00f6r&#8217;lerin \u00e7o\u011fu asl\u0131nda bir fonksiyon ve \u00f6zel olarak <strong>&lt;&lt;, &gt;&gt;<\/strong> ile birlikte kullanmak \u00fczere tasarlanm\u0131\u015ft\u0131r, ayn\u0131 zamanda fonksiyon gibi de \u00e7a\u011f\u0131rabilirsiniz (dikkatli okuyucular\u0131m, <em>\u00e7o\u011fu<\/em> dedi\u011fimi fark etmi\u015flerdir, \u00e7\u00fcnk\u00fc setw, setprecision, setbase, setfill, resetiosflags, setiosflags bu kullan\u0131m\u0131n d\u0131\u015f\u0131nda). Hemen bir \u00f6rne\u011fe bakal\u0131m:<\/p>\n<pre class=\"lang:c++ decode:true \">bool value = false;\r\nstd::boolalpha(std::cout);\r\nstd::cout &lt;&lt; value &lt;&lt; std::endl;\r\n\r\nile\r\n\r\nbool value = false;\r\nstd::cout &lt;&lt; std::boolalpha &lt;&lt; value &lt;&lt; std::endl;<\/pre>\n<p>ayn\u0131 \u00e7\u0131kt\u0131y\u0131 verir.<\/p>\n<p>\u015eimdi gelelim \u00f6nemli manip\u00fclat\u00f6rlere. Di\u011fer yaz\u0131lar\u0131mda oldu\u011fu gibi bana g\u00f6re en \u00f6nemli olanlar\u0131, kalem kalem, s\u0131ralamaya \u00e7al\u0131\u015faca\u011f\u0131m. Tam liste i\u00e7in kaynaklar k\u0131sm\u0131ndaki sayfalara ba\u015fvurabilirsiniz.<\/p>\n<ul>\n<li><strong><span class=\"code\">boolalpha,\u00a0<\/span><span class=\"code\">noboolalpha:<\/span><\/strong>\n<ul>\n<li>Boolean de\u011ferlerin metinsel\/n\u00fcmerik g\u00f6sterimi i\u00e7in kullan\u0131l\u0131r. Varsay\u0131lan n\u00fcmerik (noboolalpha) g\u00f6sterim aktiftir, <em>true<\/em> de\u011ferler 1 ve <em>false<\/em> de\u011ferler 0 olarak bast\u0131r\u0131l\u0131r. boolalpha ile birlikte bu de\u011ferler s\u0131ras\u0131 ile &#8220;true ve &#8220;false&#8221; olarak bast\u0131r\u0131l\u0131r.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showbase,\u00a0<\/span><span class=\"code\">noshowbase:<\/span><\/strong>\n<ul>\n<li>showbase \u00e7a\u011fr\u0131ld\u0131\u011f\u0131 durumda 8 d\u00fczene g\u00f6re olan say\u0131lar ba\u015flar\u0131n O, 16 l\u0131k d\u00fczene g\u00f6re olanlar 0x olarak g\u00f6sterilir.\n<pre class=\"lang:c++ decode:true code \">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\nusing namespace std;\r\nint main()\r\n{\r\n    int n1 {10};   \/\/ 10 luk d\u00fczende 10\r\n    int n2 {010};  \/\/ 8 lik d\u00fczene g\u00f6re 8\r\n    int n3 {0x10}; \/\/ 16 d\u00fczende 16\r\n    cout &lt;&lt; showbase &lt;&lt; setbase(16) &lt;&lt; \"n1 = \" &lt;&lt; n1 &lt;&lt; \", n2 = \" &lt;&lt; n2 &lt;&lt; \", n3 = \"&lt;&lt; n3 &lt;&lt; \"\\n\";\r\n    return 0;\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showpoint,\u00a0<\/span><span class=\"code\">noshowpoint:<\/span><\/strong>\n<ul>\n<li>showpoint kullan\u0131ld\u0131\u011f\u0131 zaman, ondal\u0131k k\u0131s\u0131mlar her zaman g\u00f6sterilir. Varsay\u0131lan olarak tam say\u0131ya yuvarlan\u0131r.\n<pre class=\"lang:c++ decode:true\">auto n1 {10.0F};\r\ncout &lt;&lt;  \"Once: \" &lt;&lt; n1 &lt;&lt; showpoint &lt;&lt; \" Sonra:\" &lt;&lt; n1 &lt;&lt; \"\\n\";<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showpos,\u00a0<\/span><span class=\"code\">noshowpos:<\/span><\/strong>\n<ul>\n<li>showpos ile birlikte, pozitif say\u0131lar\u0131n \u00f6n\u00fcnde ek olarak <span class=\"code\">\u2018<\/span><span class=\"code\">+<\/span><span class=\"code\">\u2018<\/span>\u00a0 g\u00f6sterilir. Varsay\u0131lan olarak g\u00f6sterilmez.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">hexfloat, fixed\u00a0<\/span><span class=\"code\">scientific, defaultfloat:<\/span><\/strong>\n<ul>\n<li>\u0130simlerinden de anlayaca\u011f\u0131n\u0131z \u00fczere bu fonksiyonlar da, ondal\u0131k say\u0131lar\u0131n nas\u0131l g\u00f6sterilece\u011fini belirliyor. Ayr\u0131ca, girdi olarak verilen de\u011ferleri de buna g\u00f6re ay\u0131klar.\u00a0Bunlar\u0131 uzun uzad\u0131ya anlatmaktansa, san\u0131r\u0131m \u00f6rnek vermek daha iyi olacak.<\/li>\n<li>\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\r\n#include &lt;sstream&gt;\r\nusing namespace std;\u00a0\r\nint main()\r\n{\r\n    cout      &lt;&lt; \"0.01 - fixed:      \" &lt;&lt; std::fixed &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - scientific: \" &lt;&lt; std::scientific &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - hexfloat:   \" &lt;&lt; std::hexfloat &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - default:    \" &lt;&lt; std::defaultfloat &lt;&lt; 0.01 &lt;&lt; '\\n';\r\n    double f;\r\n    istringstream(\"0x1P-1022\") &gt;&gt; std::hexfloat &gt;&gt; f;\r\n    cout &lt;&lt; \"0x1P-1022 hex olarak ayikladigimizda elde ettigimiz deger:\" &lt;&lt; f &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setprecision(n):<\/span><\/strong>\n<ul>\n<li>Ondal\u0131k bir say\u0131 g\u00f6sterildi\u011fi durumda, noktadan sonra g\u00f6sterilecek rakam adetini belirler. Varsay\u0131lan adet 6&#8217;d\u0131r.\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n#include &lt;cmath&gt;\r\n#include &lt;limits&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const long double pi = std::acos(-1.L);\r\n    cout &lt;&lt; \"default precision (6): \" &lt;&lt; pi &lt;&lt; '\\n'\r\n         &lt;&lt; \"setprecision(10): \" &lt;&lt; setprecision(10) &lt;&lt; pi &lt;&lt; '\\n'\r\n         &lt;&lt; \"max precision:         \"\r\n         &lt;&lt; setprecision(numeric_limits&lt;long double&gt;::digits10 + 1)\r\n         &lt;&lt; pi &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setbase(n):<\/span><\/strong>\n<ul>\n<li>Girdi ve \u00e7\u0131kt\u0131 i\u00e7in kullan\u0131lan say\u0131 sistemini belirler. 8, 10, 16 ve 0 alabilir. 0 \u00e7\u0131kt\u0131 i\u00e7in ondal\u0131k g\u00f6sterim anlam\u0131na gelse de girdi i\u00e7in girilen say\u0131dan say\u0131 sistemini belirle anlam\u0131na gelir.dec, hex, octTam say\u0131lar i\u00e7in kullan\u0131lan say\u0131 sistemini belirler.\u00a0<span class=\"code\">setbase(10),\u00a0setbase(16) ve\u00a0setbase(8) ile de ayn\u0131 sonucu alabilirsiniz.<\/span><\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">ws:<\/span><\/strong>\n<ul>\n<li>\u0130lk bo\u015fluk olmayan karakteri g\u00f6rene kadar olan bo\u015fluk karakterlerini atar.\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\r\n#include &lt;istream&gt;\r\n#include &lt;sstream&gt;\r\n#include &lt;string&gt;\r\n \r\nint main()\r\n{\r\n    std::istringstream s(\"     this is a test\");\r\n    std::string line;\r\n    std::getline(s &gt;&gt; std::ws, line);\r\n    std::cout &lt;&lt; \"ws + getline returns: \\\"\" &lt;&lt; line &lt;&lt; \"\\\"\\n\";\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">ends:<\/span><\/strong>\n<ul>\n<li>\u00c7\u0131kt\u0131ya &#8216;\\0&#8217; ekler.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">flush:<\/span><\/strong>\n<ul>\n<li>\u00c7\u0131kt\u0131ya y\u0131\u011f\u0131lan karakterleri bast\u0131rmak \u00fczere g\u00f6nderir.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">endl:<\/span><\/strong>\n<ul>\n<li>\u00c7\u0131kt\u0131ya\u00a0 &#8216;\\n&#8217; ekler ve bast\u0131rmak \u00fczere g\u00f6nderir.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setiosflags<\/span>(n)\/<span class=\"code\">resetiosflags<\/span>(n):<\/strong>\n<ul>\n<li>Verilen std::ios sabitlerini atar veya s\u0131f\u0131rlar.\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n \r\nint main()\r\n{\r\n    std::cout &lt;&lt;  std::resetiosflags(std::ios_base::dec) \r\n              &lt;&lt;  std::setiosflags(  std::ios_base::hex\r\n                                   | std::ios_base::uppercase\r\n                                   | std::ios_base::showbase) &lt;&lt; 42 &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setw(n):<\/span><\/strong>\n<ul>\n<li>Bir sonraki \u00e7\u0131kt\u0131 i\u00e7in tan\u0131mlanan geni\u015fli\u011fi belirler. Burada e\u011fer bu alanda bo\u015fluk kal\u0131r ise setfill ile belirlenmi\u015f olan karakter ile doldurulur.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setfill(c):<\/span><\/strong>\n<ul>\n<li>Bo\u015fluklar\u0131 doldurmak i\u00e7in kullan\u0131lacak olan karakteri belirler. Buradaki bo\u015fluklardan kas\u0131t, setw ile tan\u0131mlanan geni\u015flikten daha az uzunlukta bir karakter g\u00f6sterilmesinde durumunda kalan bo\u015fluklard\u0131r. Varsay\u0131lan olarak bo\u015fluk karakteri kullan\u0131l\u0131r.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">internal,\u00a0<\/span><span class=\"code\">left,\u00a0<\/span><span class=\"code\">right:<\/span><\/strong>\n<ul>\n<li>Bo\u015fluk i\u00e7in belirlenmi\u015f karakterlerin nereye yerle\u015ftirilece\u011fini belirler. <em>left<\/em> ve <em>right\u00a0<\/em>se\u00e7ene\u011fi her \u00e7\u0131kt\u0131 i\u00e7in kullan\u0131labilecekken, <em>internal<\/em> sadece tam, ondal\u0131k say\u0131 ve parasal g\u00f6sterimler i\u00e7in kullan\u0131l\u0131r.<\/li>\n<li>\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n#include &lt;locale&gt;\r\n \r\nint main()\r\n{\r\n    std::cout &lt;&lt; \"Left fill:\\n\" &lt;&lt; std::left &lt;&lt; std::setfill('*')\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; std::hex &lt;&lt; std::showbase &lt;&lt; 42 &lt;&lt; '\\n';\r\n \r\n    std::cout &lt;&lt; \"Internal fill:\\n\" &lt;&lt; std::internal\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; 42 &lt;&lt; '\\n';\r\n \r\n    std::cout &lt;&lt; \"Right fill:\\n\" &lt;&lt; std::right\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; 42 &lt;&lt; '\\n';\r\n}<\/pre>\n<p>&nbsp;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Evet arkada\u015flar, art\u0131k uygulamalar\u0131n\u0131zda konsolu, standart \u00e7\u0131kt\u0131y\u0131, istedi\u011finiz gibi kullanabilirsiniz \ud83d\ude42<\/p>\n<p>Bir sonraki yaz\u0131mda bulu\u015fmak dile\u011fiyle.<\/p>\n<h2><span style=\"color: #0000ff;\"><strong>Kaynaklar:<\/strong><\/span><\/h2>\n<ul>\n<li><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/io\/manip\"><span style=\"color: #339966;\"><strong>https:\/\/en.cppreference.com\/w\/cpp\/io\/manip<\/strong><\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.cplusplus.com\/reference\/library\/manipulators\/\"><span style=\"color: #339966;\"><strong>http:\/\/www.cplusplus.com\/reference\/library\/manipulators\/<\/strong><\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.tutorialspoint.com\/What-are-Cplusplus-Manipulators-endl-setw-setprecision-setf\"><span style=\"color: #339966;\"><strong>https:\/\/www.tutorialspoint.com\/What-are-Cplusplus-Manipulators-endl-setw-setprecision-setf<\/strong><\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.uow.edu.au\/~lukes\/TEXTBOOK\/notes-cpp\/io\/omanipulators.html\"><span style=\"color: #339966;\"><strong>https:\/\/www.uow.edu.au\/~lukes\/TEXTBOOK\/notes-cpp\/io\/omanipulators.html<\/strong><\/span><\/a><\/li>\n<\/ul>\n<p>[:en]In our programs, especially for small ones, to display some values \u200b\u200bquickly, one of the most common methods we use is to print something on standard output.<br \/>\nFor C ++, the most common method used for this is probably <em>std :: cout<\/em>. So how much are we familiar with this library&#8217;s abilities? In this article, I will bring you the associated features to your attention.<br \/>\nThe structures that allow you to control what you print on the standard output are called &#8220;I\/O manipulators&#8221;. To use them, you need to include the header file &#8220;#include &lt;iomanip&gt;&#8221; in your code. Most of these manipulators are actually a function and are specially designed to use with &lt;&lt;, &gt;&gt;, operators, but you can also call it as a function (as some of my readers have noticed, setw, setprecision, setbase, setfill, resetiosflags, setiosflags are not used this way). Let&#8217;s look at an example:<\/p>\n<pre class=\"lang:c++ decode:true\">bool value = false;\r\nstd::boolalpha(std::cout);\r\nstd::cout &lt;&lt; value &lt;&lt; std::endl;\r\n\r\nand\r\n\r\nbool value = false;\r\nstd::cout &lt;&lt; std::boolalpha &lt;&lt; value &lt;&lt; std::endl;<\/pre>\n<p>give the same output.<\/p>\n<p>Now, let us look at important manipulators. As in my other writings, I will try to focus on the most important ones, one by one. For a complete list, refer to the pages in the resources section.<\/p>\n<ul>\n<li><strong><span class=\"code\">boolalpha,\u00a0<\/span><span class=\"code\">noboolalpha:<\/span><\/strong>\n<ul>\n<li>Used for textual \/ numerical representation of boolean values. The default numeric (noboolalpha) notation is active, <em>true<\/em> values are displayed as 1 and false values are displayed as 0. With boolalpha, these values are displayed as &#8220;<em>true&#8221;<\/em> and &#8220;<em>false<\/em>&#8220;, respectively.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showbase,\u00a0<\/span><span class=\"code\">noshowbase:<\/span><\/strong>\n<ul>\n<li>In the case where showbase API is called, the numbers are displayed according to the 8 numbering base system are shown with 0, the ones according to the 16 basis are shown as 0x.\n<pre class=\"lang:c++ decode:true code \">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\nusing namespace std;\r\nint main()\r\n{\r\n    int n1 {10};   \/\/ 10 luk d\u00fczende 10\r\n    int n2 {010};  \/\/ 8 lik d\u00fczene g\u00f6re 8\r\n    int n3 {0x10}; \/\/ 16 d\u00fczende 16\r\n    cout &lt;&lt; showbase &lt;&lt; setbase(16) &lt;&lt; \"n1 = \" &lt;&lt; n1 &lt;&lt; \", n2 = \" &lt;&lt; n2 &lt;&lt; \", n3 = \"&lt;&lt; n3 &lt;&lt; \"\\n\";\r\n    return 0;\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showpoint,\u00a0<\/span><span class=\"code\">noshowpoint:<\/span><\/strong>\n<ul>\n<li>\n<div class=\"tlid-input input\">\n<div class=\"source-wrap\">\n<div class=\"input-full-height-wrapper tlid-input-full-height-wrapper\">\n<div class=\"source-input\">\n<div class=\"source-footer-wrap source-or-target-footer\">\n<div class=\"character-count tlid-character-count\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tlid-results-container results-container\">\n<div class=\"tlid-result result-dict-wrapper\">\n<div class=\"result tlid-copy-target\">\n<div class=\"text-wrap tlid-copy-target\">\n<div class=\"result-shield-container tlid-copy-target\" tabindex=\"0\"><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">When showpoint is used, decimal parts are always shown.<\/span> <span class=\"\" title=\"\">By default, it is rounded to an integer.<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<pre class=\"lang:c++ decode:true\">auto n1 {10.0F};\r\ncout &lt;&lt;  \"Once: \" &lt;&lt; n1 &lt;&lt; showpoint &lt;&lt; \" Sonra:\" &lt;&lt; n1 &lt;&lt; \"\\n\";<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">showpos,\u00a0<\/span><span class=\"code\">noshowpos:<\/span><\/strong>\n<ul>\n<li>With showpos, positive numbers are displayed with &#8220;+&#8221;. Not displayed by default.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">hexfloat, fixed\u00a0<\/span><span class=\"code\">scientific, defaultfloat:<\/span><\/strong>\n<ul>\n<li>As you can tell from their names, these functions determine how decimal numbers are displayed. It also extracts the values given as input accordingly. I think it would be better to give an example about their usage.<\/li>\n<li>\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\r\n#include &lt;sstream&gt;\r\nusing namespace std;\u00a0\r\nint main()\r\n{\r\n    cout      &lt;&lt; \"0.01 - fixed:      \" &lt;&lt; std::fixed &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - scientific: \" &lt;&lt; std::scientific &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - hexfloat:   \" &lt;&lt; std::hexfloat &lt;&lt; 0.01 &lt;&lt; '\\n'\r\n              &lt;&lt; \"0.01 - default:    \" &lt;&lt; std::defaultfloat &lt;&lt; 0.01 &lt;&lt; '\\n';\r\n    double f;\r\n    istringstream(\"0x1P-1022\") &gt;&gt; std::hexfloat &gt;&gt; f;\r\n    cout &lt;&lt; \"0x1P-1022 hex olarak ayikladigimizda elde ettigimiz deger:\" &lt;&lt; f &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setprecision(n):<\/span><\/strong>\n<ul>\n<li>When a decimal number is displayed, it determines the number of digits to be displayed after the period. The default is 6.<\/li>\n<li>\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n#include &lt;cmath&gt;\r\n#include &lt;limits&gt;\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    const long double pi = std::acos(-1.L);\r\n    cout &lt;&lt; \"default precision (6): \" &lt;&lt; pi &lt;&lt; '\\n'\r\n         &lt;&lt; \"setprecision(10): \" &lt;&lt; setprecision(10) &lt;&lt; pi &lt;&lt; '\\n'\r\n         &lt;&lt; \"max precision:         \"\r\n         &lt;&lt; setprecision(numeric_limits&lt;long double&gt;::digits10 + 1)\r\n         &lt;&lt; pi &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setbase(n):<\/span><\/strong>\n<ul>\n<li>Specifies the numbering base system used for input and output which can be either 8, 10, 16 and 0. Although 0 is a decimal notation for output, it tells system to determine numbering base system automatically with respect to entered number for the input. You can get the same result with setbase (10), setbase (16) and setbase (8).<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">ws:<\/span><\/strong>\n<ul>\n<li>Removes the space characters until it sees the first non-space character.\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\r\n#include &lt;istream&gt;\r\n#include &lt;sstream&gt;\r\n#include &lt;string&gt;\r\n \r\nint main()\r\n{\r\n    std::istringstream s(\"     this is a test\");\r\n    std::string line;\r\n    std::getline(s &gt;&gt; std::ws, line);\r\n    std::cout &lt;&lt; \"ws + getline returns: \\\"\" &lt;&lt; line &lt;&lt; \"\\\"\\n\";\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">ends:<\/span><\/strong>\n<ul>\n<li>Adds &#8216;\\ 0&#8217; to the output.<\/li>\n<\/ul>\n<\/li>\n<li><strong>flush:<\/strong>\n<ul>\n<li>Sends the output stacked characters to print.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">endl:<\/span><\/strong>\n<ul>\n<li>Adds &#8216;\\ n&#8217; to the output and sends it to print.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setiosflags<\/span>(n)\/<span class=\"code\">resetiosflags<\/span>(n):<\/strong>\n<ul>\n<li>Assigns or resets the given std::ios values.\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n \r\nint main()\r\n{\r\n    std::cout &lt;&lt;  std::resetiosflags(std::ios_base::dec) \r\n              &lt;&lt;  std::setiosflags(  std::ios_base::hex\r\n                                   | std::ios_base::uppercase\r\n                                   | std::ios_base::showbase) &lt;&lt; 42 &lt;&lt; '\\n';\r\n}<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setw(n):<\/span><\/strong>\n<ul>\n<li>Determines the width defined for the next output. If there is any space left in this field, it is filled with the character specified by setfill.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">setfill(c):<\/span><\/strong>\n<ul>\n<li>Specifies the character to be used to fill in the blanks. The spaces herein refer to spaces that are displayed when a character less than the width defined by setw is displayed. The space character is used by default.<\/li>\n<\/ul>\n<\/li>\n<li><strong><span class=\"code\">internal,\u00a0<\/span><span class=\"code\">left,\u00a0<\/span><span class=\"code\">right:<\/span><\/strong>\n<ul>\n<li>Specifies where to place the characters specified for the space. The <em>left<\/em> and <em>right<\/em> option can be used for each output, while <em>internal<\/em> is only used for integer, decimal, and monetary representations.\n<pre class=\"lang:c++ decode:true\">#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n#include &lt;locale&gt;\r\n \r\nint main()\r\n{\r\n    std::cout &lt;&lt; \"Left fill:\\n\" &lt;&lt; std::left &lt;&lt; std::setfill('*')\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; std::hex &lt;&lt; std::showbase &lt;&lt; 42 &lt;&lt; '\\n';\r\n \r\n    std::cout &lt;&lt; \"Internal fill:\\n\" &lt;&lt; std::internal\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; 42 &lt;&lt; '\\n';\r\n \r\n    std::cout &lt;&lt; \"Right fill:\\n\" &lt;&lt; std::right\r\n              &lt;&lt; std::setw(12) &lt;&lt; -1.23  &lt;&lt; '\\n'\r\n              &lt;&lt; std::setw(12) &lt;&lt; 42 &lt;&lt; '\\n';\r\n}<\/pre>\n<p>&nbsp;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Yes my friends, now on you can use the console, standard output, in your applications as you like \ud83d\ude42<\/p>\n<p>Hope to meet you in my next article.<\/p>\n<h2><span style=\"color: #0000ff;\"><strong>References:<\/strong><\/span><\/h2>\n<ul>\n<li><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/io\/manip\"><span style=\"color: #339966;\"><strong>https:\/\/en.cppreference.com\/w\/cpp\/io\/manip<\/strong><\/span><\/a><\/li>\n<li><a href=\"http:\/\/www.cplusplus.com\/reference\/library\/manipulators\/\"><span style=\"color: #339966;\"><strong>http:\/\/www.cplusplus.com\/reference\/library\/manipulators\/<\/strong><\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.tutorialspoint.com\/What-are-Cplusplus-Manipulators-endl-setw-setprecision-setf\"><span style=\"color: #339966;\"><strong>https:\/\/www.tutorialspoint.com\/What-are-Cplusplus-Manipulators-endl-setw-setprecision-setf<\/strong><\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.uow.edu.au\/~lukes\/TEXTBOOK\/notes-cpp\/io\/omanipulators.html\"><span style=\"color: #339966;\"><strong>https:\/\/www.uow.edu.au\/~lukes\/TEXTBOOK\/notes-cpp\/io\/omanipulators.html<\/strong><\/span><\/a><\/li>\n<\/ul>\n<p>[:]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[:tr]Programlar\u0131m\u0131zda, \u00f6zellikle k\u00fc\u00e7\u00fck olanlarda ya da baz\u0131 de\u011ferleri h\u0131zl\u0131ca g\u00f6r\u00fcnt\u00fclemek i\u00e7in, en s\u0131k kulland\u0131\u011f\u0131m\u0131z y\u00f6ntemlerden birisi de standart \u00e7\u0131kt\u0131ya bir \u015feyler basmakt\u0131r. Bunun i\u00e7in de kullan\u0131lan en yayg\u0131n y\u00f6ntem, C++ i\u00e7in, std::cout&#8216;t\u0131r muhtemelen. Peki bu karde\u015fimizin kabiliyetlerine ne kadar vak\u0131f\u0131z? \u0130\u015fte bu yaz\u0131mda bu karde\u015fimize ili\u015fkin yetenekler ile sizleri bulu\u015fturaca\u011f\u0131m. \u00d6ncelikli olarak standart \u00e7\u0131kt\u0131ya bast\u0131klar\u0131n\u0131z\u0131&#8230; <a class=\"more-link\" href=\"https:\/\/yazilimperver.com\/index.php\/2019\/05\/03\/haftalik-c-15-girdi-cikti-manipulatorleri\/\">Continue reading <span class=\"meta-nav\">&#8594;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":174,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"0","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","dsgo_overlay_header":false,"dsgo_overlay_header_text_color":"","dsgo_overlay_skip_top_bar":false,"_designsetgo_exclude_llms":false,"footnotes":""},"categories":[10,41],"tags":[438,13,431,425,430,429,417,418,419,42,439,437,435,433,423,420,427,421,424,428,422,436,434,432,426],"class_list":["post-1140","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c","category-modern-c","tag-boolalpha","tag-c","tag-defaultfloat","tag-endl","tag-fixed-scientific","tag-hexfloat","tag-i-o-manipulators","tag-internal","tag-left","tag-modern-c","tag-noboolalpha","tag-noshowbase","tag-noshowpoint","tag-noshowpos","tag-resetiosflags","tag-right","tag-setbase","tag-setfill","tag-setiosflags","tag-setprecision","tag-setw","tag-showbase","tag-showpoint","tag-showpos","tag-ws"],"_links":{"self":[{"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/posts\/1140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/comments?post=1140"}],"version-history":[{"count":0,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/posts\/1140\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/media\/174"}],"wp:attachment":[{"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/media?parent=1140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/categories?post=1140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yazilimperver.com\/index.php\/wp-json\/wp\/v2\/tags?post=1140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}