久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='OTKol'><tr id='OTKol'><dt id='OTKol'><q id='OTKol'><span id='OTKol'><b id='OTKol'><form id='OTKol'><ins id='OTKol'></ins><ul id='OTKol'></ul><sub id='OTKol'></sub></form><legend id='OTKol'></legend><bdo id='OTKol'><pre id='OTKol'><center id='OTKol'></center></pre></bdo></b><th id='OTKol'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='OTKol'><tfoot id='OTKol'></tfoot><dl id='OTKol'><fieldset id='OTKol'></fieldset></dl></div>

      <legend id='OTKol'><style id='OTKol'><dir id='OTKol'><q id='OTKol'></q></dir></style></legend>

      <small id='OTKol'></small><noframes id='OTKol'>

      • <bdo id='OTKol'></bdo><ul id='OTKol'></ul>
      <tfoot id='OTKol'></tfoot>
    1. 為什么在我包含 cin.get() 后控制臺會關(guān)閉?

      Why is the Console Closing after I#39;ve included cin.get()?(為什么在我包含 cin.get() 后控制臺會關(guān)閉?)

          • <bdo id='n1Gqs'></bdo><ul id='n1Gqs'></ul>

            1. <i id='n1Gqs'><tr id='n1Gqs'><dt id='n1Gqs'><q id='n1Gqs'><span id='n1Gqs'><b id='n1Gqs'><form id='n1Gqs'><ins id='n1Gqs'></ins><ul id='n1Gqs'></ul><sub id='n1Gqs'></sub></form><legend id='n1Gqs'></legend><bdo id='n1Gqs'><pre id='n1Gqs'><center id='n1Gqs'></center></pre></bdo></b><th id='n1Gqs'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='n1Gqs'><tfoot id='n1Gqs'></tfoot><dl id='n1Gqs'><fieldset id='n1Gqs'></fieldset></dl></div>
                <legend id='n1Gqs'><style id='n1Gqs'><dir id='n1Gqs'><q id='n1Gqs'></q></dir></style></legend>

                <small id='n1Gqs'></small><noframes id='n1Gqs'>

                  <tbody id='n1Gqs'></tbody>
                <tfoot id='n1Gqs'></tfoot>
                本文介紹了為什么在我包含 cin.get() 后控制臺會關(guān)閉?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                限時送ChatGPT賬號..

                我剛剛開始使用 C++ Primer Plus 學(xué)習(xí) C++,但我在其中一個示例中遇到了問題.就像書中指示的那樣,我在末尾包含了 cin.get() 以防止控制臺自行關(guān)閉.但是,在這種情況下,除非我添加兩個我不理解的 cin.get() 語句,否則它仍然會自行關(guān)閉.我使用的是 Visual Studio Express 2010.

                I've just started learning C++ using C++ Primer Plus but I'm having trouble with one of the examples. Like the book instructed I included cin.get() at the end to prevent the console from closing by itself. However, in this instance it still closes by itself unless I add two cin.get() statements which I don't understand. I'm using Visual Studio Express 2010.

                #include <iostream>
                
                int main()
                {
                    int carrots;
                
                    using namespace std;
                    cout << "How many carrots do you have?" << endl;
                    cin >> carrots;
                    carrots = carrots + 2;
                    cout << "Here are two more. Now you have " << carrots << " carrots.";
                    cin.get();
                    return 0;
                }
                

                推薦答案

                cin >> carrots;
                

                這一行在輸入流中留下一個尾隨換行符,然后被下一個 cin.get() 使用.在此之前直接執(zhí)行一個簡單的 cin.ignore() :

                This line leaves a trailing newline token in the input stream, which then gets consumed by the next cin.get(). Just do a simple cin.ignore() directly before that:

                cin.ignore();
                cin.get();
                

                這篇關(guān)于為什么在我包含 cin.get() 后控制臺會關(guān)閉?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Why do two functions have the same address?(為什么兩個函數(shù)的地址相同?)
                Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復(fù)制構(gòu)造的?)
                mixing templates with polymorphism(混合模板與多態(tài)性)
                When should I use the keyword quot;typenamequot; when using templates(我什么時候應(yīng)該使用關(guān)鍵字“typename?使用模板時)
                Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標(biāo)準(zhǔn)庫)
                gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數(shù)模板,而 clang 不能)

                  <small id='VGZ29'></small><noframes id='VGZ29'>

                1. <i id='VGZ29'><tr id='VGZ29'><dt id='VGZ29'><q id='VGZ29'><span id='VGZ29'><b id='VGZ29'><form id='VGZ29'><ins id='VGZ29'></ins><ul id='VGZ29'></ul><sub id='VGZ29'></sub></form><legend id='VGZ29'></legend><bdo id='VGZ29'><pre id='VGZ29'><center id='VGZ29'></center></pre></bdo></b><th id='VGZ29'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VGZ29'><tfoot id='VGZ29'></tfoot><dl id='VGZ29'><fieldset id='VGZ29'></fieldset></dl></div>
                  <legend id='VGZ29'><style id='VGZ29'><dir id='VGZ29'><q id='VGZ29'></q></dir></style></legend>
                  <tfoot id='VGZ29'></tfoot>
                        <bdo id='VGZ29'></bdo><ul id='VGZ29'></ul>
                          <tbody id='VGZ29'></tbody>
                        • 主站蜘蛛池模板: 国产91丝袜在线播放 | 黄色小视频在线观看 | 欧美福利一区二区 | 亚洲在线视频观看 | 欧美性生交 | 人人澡人人爽 | 天天干天天干天天操 | 免费看成人片 | 日韩在线精品 | 欧美资源在线 | 黄网站免费大全入口 | 日本xxxx69 | 欧美日韩免费一区二区三区 | 亚洲激情欧美激情 | 黄色福利视频 | 黄色片视频免费 | 欧美在线视频播放 | 一本色道久久综合亚洲精品小说 | 福利视频一区二区 | 性色av一区| 中文字幕不卡视频 | 在线观看福利影院 | 在线观看网址你懂的 | 男女操网站 | 天天干天天操天天射 | 亚洲欧美另类在线观看 | 真实的国产乱xxxx在线 | 色综合天天综合网天天狠天天 | 日韩精品视频免费 | 美女免费网站 | 亚洲精品久久久 | 一级片在线免费观看 | 在线午夜视频 | 香蕉成人| aaa亚洲| 国产三级黄色片 | 999久久久 | 在线视频91 | 国产一区二区中文字幕 | 久热精品视频在线观看 | 激情91 |