阅读背景:

无论在循环中输入多少字符串,其他参数只出现一次

来源:互联网 
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    string input = " ";
    cout << "Do you wanted to input : " << endl << "a. String" << endl 
         << "b. Integer" << endl;
    while (input != "A" || input != "a" || input != "B" || input != "b")
    {
        cin >> setw(1) >> input;
        if (input == "A" || input == "a")
        {
            cout << "String" << endl; break;
        }
        else if (input == "B" || input == "b")
        {
            cout << "int" << endl; 
            break;
        }
        else
        {
            cout << "Please input only the given option." << endl;
        }
    }
}
#include <iostream>
#include <iomanip>

using n



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: