• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            逛奔的蝸牛

            我不聰明,但我會很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::
            #include <iostream>
            #include <conio.h>
            /**
             * 秘密在于conio.h中的getch()從鍵盤中讀取字符時,并不會在屏幕上輸出已經輸入的字符,
             * 而用一個putch('*')來哄騙,代表已經輸入一個字符
             * 怪不得這個頭文件要叫conio.h, con的意思就有哄騙,看來就是由此而來.
             */
            using namespace std;
            int main() {
                    char* password;
                    char* passwordConfirm;
                    int length = 4;
                    password = new char[length + 1];
                    passwordConfirm = new char[length + 1];
                    char* p = NULL;
                    int count = 0;
                    cout << "Input password : ";
                    p = password;
                    count = 0;
                    //fflush(stdin);
                    while (((*p = getch()) != 13) && count < length) {
                            // 這里不是'\n'(10), new line
                            // 而是'\r'(13), reback. 即是按下回車鍵,好像這個東西是linux的.
                            // 主要是與getch這個函數有關.
                            putch('*');
                            fflush(stdin);
                            p++;
                            count++;
                    }
                    password[count] = '\0';
                    cout << endl << "Confirm the password : ";
                    p = passwordConfirm;
                    count = 0;
                    //fflush(stdin);
                    while (((*p = getch()) != 13) && count < length) {
                            putch('*');
                            fflush(stdin);
                            p++;
                            count++;
                    }
                    passwordConfirm[count] = '\0';
                    cout << endl;
                    if (strcmp(password, passwordConfirm) == 0) {
                            cout << "The password is right." << endl;
                            cout << password << endl;
                    } else {
                            cout << "Confirm password fail." << endl;
                            cout << password << endl << passwordConfirm << endl;
                    }
                    return 0;
            }
            posted on 2010-12-17 18:12 逛奔的蝸牛 閱讀(2272) 評論(0)  編輯 收藏 引用 所屬分類: C/C++
            日日狠狠久久偷偷色综合免费| 久久精品国产国产精品四凭 | 久久精品国产亚洲AV影院| 波多野结衣久久| 久久偷看各类wc女厕嘘嘘| 久久精品中文字幕久久| 亚洲精品97久久中文字幕无码| 久久狠狠爱亚洲综合影院| 久久精品草草草| 久久久久久午夜成人影院| 久久涩综合| 精品水蜜桃久久久久久久| 久久综合伊人77777| 久久无码av三级| 久久精品国产福利国产秒| 精品无码久久久久久尤物| 亚洲国产天堂久久综合网站 | 国产69精品久久久久777| 久久国产视频网| 99国产精品久久| 伊人久久综合精品无码AV专区| 久久精品国产免费观看三人同眠| 国产亚洲综合久久系列| 久久精品国产99久久久古代| 久久久久亚洲AV成人网| 久久伊人精品青青草原高清| 久久99精品久久久久久久不卡| 久久亚洲国产精品成人AV秋霞| 欧美日韩成人精品久久久免费看| 久久综合狠狠色综合伊人| 97久久天天综合色天天综合色hd | 国内精品久久久久久久亚洲| 66精品综合久久久久久久| 久久精品国产福利国产秒| 91久久精品视频| 国产精品久久久天天影视香蕉 | 99国内精品久久久久久久| 夜夜亚洲天天久久| 久久久久久噜噜精品免费直播 | 久久久久免费精品国产| 亚洲精品国精品久久99热一|