Отладка приводит к многочисленным ошибкам.Код работал хорошо, когда я использовал его на школьном компьютере.Но не на моем собственном ПК - PullRequest
0 голосов
/ 25 сентября 2019

Я не могу собрать исполняемый файл из этой программы.

Я пытался добавить Windows универсальный CRT SDK или изменить Windows SDK, но он просто не работал.

Вот ошибки, которые яполучил:

variable _ACRTIMP is not a type name
The Windows SDK version 10.0.17134.o was not found. Install the requested version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
the global scope has no "_Mbstatet"
the global scope has no "Exit"
the global scope has no "wscanf"
the global scope has no "wprintf"
the global scope has no "memset"

А вот код:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
    bool      isNew = true,   isNew2 = true, isNew3 = true;
    bool      isAuto = true,   isAuto2 = true, isAuto3 = true;

    //working variables
    float     totalprice = 0.00;
    int       choice = 0;
    bool      isValid = true;

    float     baseprice = 40000.0, baseprice2 = 293200.0, baseprice3 = 35000.0;
    float     taxrate = 1.0875;

    short int year = 2019, year2 = 2019, year3 = 2019;
    int       mileage = 20, mileage2 = 20, mileage3 = 20;

    string    make = "BMW", make2 = "Porsche", make3 = "Ford";
    string    model = "x3", model2 = "911 GT2 RS", model3 = "Mustang";
    string    color = "Red", color2 = "Grey", color3 = "Yellow";
    string    Engine = "v8", engine2 = "liter Boxer", engine3 = "V8";
    string    dname = "Statecars";

    //Display the welcome message
    cout << "Welcome to " << dname << "!" << endl;
    cout << "We sell the following cars! " << endl;
    cout << "1. " << year << " " << color << " " << make << " " << model << endl;
    cout << "2. " << year2 << " " << color2 << " " << make2 << " " << model2 << endl;
    cout << "3. " << year3 << " " << color3 << " " << make3 << " " << model3 << endl;
    cout << "Enter your car choice [1-3]?:  ";
    cin >> choice;

    switch (choice)
    {
    case (1):
        totalprice = baseprice * taxrate;
        break;
    case (2):
        totalprice = baseprice2 * taxrate;
        break;
    case (3):
        totalprice = baseprice3 * taxrate;
        break;
    default:
    {
        isValid = false;
    }
    }

    if (isValid)
    {
        cout << "The total price is: $" << fixed << setprecision(2) << totalprice;
    }
    else
    {
        cout << "invalid choice!" << endl;
    }


    system("pause"); //keep the output screen open

    return 0;
}

1 Ответ

0 голосов
/ 26 сентября 2019

Windows SDK версии 10.0.17134.0 не найден. Вам следует загрузить SDK.

Запустите установщик Visual Studio, нажмите «Изменить» и выберите Windows 10 SDK (10.0.17134.0) в списке SDK, библиотек и инфраструктуры.на вкладке отдельных компонентов установщика.

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...