Загрузка...

Помогите c++ 2017

Тема в разделе C/C++ создана пользователем Lolkaip_inactive602527 6 дек 2018. 166 просмотров

Загрузка...
  1. Lolkaip_inactive602527
    Lolkaip_inactive602527 Автор темы 6 дек 2018 4 25 сен 2018
    как решить ошибки?
    (оставил на них комментарии)









    #include "pch.h"
    #include <cstdlib>
    #include <iostream>
    using namespace std;

    int main()
    {
    int a;
    int b;
    int c = 100;
    int d;
    cout << "Hello" << endl;
    cout << "You have 100 coins" << endl;
    cout << "Your task is to earn 1000 coins choosing a color in roulette — black x2(48 % )" << endl;
    cout << "red x3(32 % ), blue x5(18 % ) and gold x50(2 % )" << endl;
    while (c < 10000) {
    cout << "Enter how many coins you want to put : " << endl;
    cin >> a;
    while (a > c)
    {
    cout << "You do not have many coins" << endl;
    cout << "Enter how many coins you want to put : " << endl;
    cin >> a;
    }
    cout << "Chose color(1 — black; 2 — red; 3 — blue; 4 — gold)" << endl;
    cin >> b;
    while (b > 4)
    {
    cout << "Enter a number from 1 to 4 (1 — black; 2 — red; 3 — blue; 4 — gold)" << endl;
    cin >> b;
    }
    while (b < 0) {
    cout << "Enter a number from 1 to 4 (1 — black; 2 — red; 3 — blue; 4 — gold)" << endl;
    cin >> b;
    }
    d = rand() % 54 + 1;
    cout << "Fell out " << d << endl;
    if (b == 1) {
    if (d < 27) {
    c = c + a;
    cout << "You won.You have " << c << " coins" << endl;
    }
    else {
    c = c - a;
    cout << "You lose.You have " << c << " coins" << endl;
    }
    }
    else
    if (b == 2) {
    if (26 < d < 44) {
    c = c + a2; //ЗДЕСЬ ОШИБКА идентификатор a2 не определён
    cout << "You won.You have " << c << " coins" << endl;
    }
    else {
    c = c - a;
    cout << "You lose.You have " << c << " coins" << endl;
    }
    }
    else
    if (b == 3) {
    if (43 < d < 54)
    {
    c = c + a4; //ЗДЕСЬ ОШИБКА идентификатор a4 не определён
    cout << "You won.You have " << c << " coins" << endl;
    }
    else {
    c = c - a;
    cout << "You lose.You have " << c << " coins" << endl;
    }
    }
    else
    if (b == 4)
    {
    if (d == 54)
    {
    c = c + a * 49;
    cout << "You won.You have " << c << " coins" << endl;
    }
    else {
    c = c - a;
    cout << "You lose.You have " << c << " coins" << endl;
    }
    }
    }
    if (c > 10000) {
    cout << "Congratulations !You won this game.You have " << c << " coins" << endl;
    }
    system("pause");
    return 0;
     
  2. Lolkaip_inactive602527
    Lolkaip_inactive602527 Автор темы 6 дек 2018 4 25 сен 2018
    решил спасибо
     
  3. storlokol
    storlokol 7 дек 2018 496 12 сен 2013
    Будешь должен как бы :roflanZdarova:
     
Top