打印随机数

问题描述 投票:0回答:1
#include <iostream>

using namespace std;

int main() {

    char gun;
    char att;

    cout << "Guns" << endl;

    cout << "[1]    AK" << endl;
    cout << "[2]    MP5" << endl;
    cout << "[3]    M2" << endl;
    cout << "[4]    SAR" << endl;
    cout << "[5]    Tommy" << endl;
    cout << "[6]    Custom" << endl;
    cin >> gun;

    cout << "[A]    Holosight" << endl;
    cout << "[B]    Simplesight" << endl;
    cout << "[C]    Silencer" << endl;
    cout << "[D]    Muzzel Boost" << endl;
    cout << "[E]    Muzzel Break" << endl;
    cout << "[F]    8x Zoom Scope" << endl;
    cout << "[G]    16x Zoom Scope" << endl;
    cout << "[H]    Lasersight" << endl;
    cin >> att;

    switch (gun) {

    case'1':
        if (gun = 1)
            cout << 'test' << endl;
        else
            cout << "Wrong Command" << endl;
        break;
    }

}

[当我运行此代码并选择1(代码仅构建一半)时,它会显示“ 1952805748”。我尝试添加更多的案例,它仍然有此问题。

有人可以帮我解决这个问题。

c++ helper
1个回答
0
投票

您在这里遇到几个问题:

© www.soinside.com 2019 - 2024. All rights reserved.