Question

I am trying to run this program in Visual Studio 2017. I keep getting this build...

I am trying to run this program in Visual Studio 2017. I keep getting this build error: error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 1>Done building project "ConsoleApplication2.vcxproj" -- FAILED.

#include <iostream>

#include<cstdlib>

#include<fstream>

#include<string>

using namespace std;

void showChoices()

{

cout << "\nMAIN MENU" << endl;

cout << "1: Addition " << endl;

cout << "2: Subtraction" << endl;

cout << "-1: Quit the program " << endl;

cout << "Enter your choice :";

}

long add(long a, long b)

{

return a + b;

}

long subtract(long a, long b)

{ if(a>b)

return (a - b);

else

return (b - a);

}

int main()

{

long x, y,dc=1,d=0,nc=0,t;

int choice;

char ch[5]={'a','b','c','d','e'},ch1;

int option[4];

string username,filename,date;

bool flag=false;

ofstream myReadFile;

  

int dlevel,i=0,nch=0,index,attempt=0;

cout<<"Eneter User Name:";

cin>>username;

//cout<<"Eneter file Name:";

//cin>>filename;

cout<<"Eneter the Date:";

cin>>date;

filename.append(".txt");

myReadFile.open("score.txt");

cout<<"Enter Difficulty Level:";

cin>>dlevel;

while(i<dlevel)

{

dc*=10;

i++;

}

  

myReadFile<<"name:"<<username<<" level:"<<dlevel<<" Date"<< date <<endl;

while(1)

{

showChoices();

x=rand()%dc+1;

y=rand()%dc+1;

cin.clear();

fflush(stdin);

cin >> choice;

if(!((choice>=1&&choice<=2)))

break;

switch (choice)

{

case 1:

cin.clear();

fflush(stdin);

for(i=0;i<4;i++)

option[i]=rand()%(dc);

index=rand()%4;

option[index]=add(x,y);

cout<<"Sum(X+Y) of"<<x<<" and "<<y<<" is:"<<endl;

for(i=0;i<4;i++)

cout<<"\n("<<ch[i]<<") "<<option[i];

cout<<"\n(e)Non of the Above";

while(!flag&&attempt<3)

{

cout<<"\nEnter you Choice: ";

cin>>ch1;

for(i=0;i<4;i++)

if(ch[i]==ch1)

break;

if(i==index)

{

d++;

cout<<"\nCongrats Correct choice";

flag=true;

}

attempt++;

}

if(attempt==3)

nc++;

attempt=0;flag=false;

if(i==index)

myReadFile<<"Sum(X+Y) of"<<x<<" and "<<y<<" is correct in:"<<attempt<<"attempt"<<endl;

else

myReadFile<<"Sum(X+Y) of"<<x<<" and "<<y<<" is incorrect in:"<<attempt<<"attempt"<<endl;

break;

case 2:

attempt=0;

cin.clear();

fflush(stdin);

flag=false;

for(i=0;i<4;i++)

option[i]=rand()%(dc-d+1)+d;

index=rand()%4;

option[index]=subtract(x,y);

if (x<y)

{

t=x;

x=y;

y=t;}

cout<<"Subtraction of"<<x<<" and "<<y<<" is:"<<endl;

for(i=0;i<4;i++)

cout<<"\n("<<ch[i]<<") "<<option[i];

cout<<"\n(e)Non of the Above";

while(!flag&&attempt<3)

{

cout<<"\nEnter you Choice: ";

cin>>ch1;

for(i=0;i<4;i++)

if(ch[i]==ch1)

break;

if(i==index)

{

d++;

cout<<"\nCongrats Correct choice";

flag=true;

}

attempt++;

}

if(attempt==3)

nc++;

attempt=0;flag=false;

if(i==index)

myReadFile<<"Subtraction of"<<x<<" and "<<y<<" is correct in:"<<attempt<<"attempt"<<endl;

else  

myReadFile<<"Subtraction of"<<x<<" and "<<y<<" is incorrect in:"<<attempt<<"attempt"<<endl;

break;

default:

cout << "Invalid input" << endl;

}

}

myReadFile<<"Correct Answer:"<<d<<"\n"<<"Correct Answer:"<<nc;

myReadFile.close();

return 0;

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) You can Run Online

2) If you want to fix it , Please do the following.


a) Run the Visual Studio 2017 Installer,
b) Go to 'Individual Components' and select Windows 8.1 SDK.
3) Go back to to the project > Right click and Re-target to match the SDK


Do the following, here
Workloads Individual components Language packs Cordova 6.3.1 toolset Entity Framework 6 tools Graphics Tools Windows 8.1 SDK

Add a comment
Know the answer?
Add Answer to:
I am trying to run this program in Visual Studio 2017. I keep getting this build...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ getline errors I am getting getline is undefined error messages. I would like the variables...

    C++ getline errors I am getting getline is undefined error messages. I would like the variables to remain as strings. Below is my code. #include <iostream> #include<string.h> using namespace std; int index = 0; // variable to hold how many customers are entered struct Address //Structure for the address. { int street; int city; int state; int zipcode; }; // Customer structure struct Customer { string firstNm, lastNm; Address busAddr, homeAddr; }; // Functions int displayMenu(); Customer getCustomer(); void showCustomer(Customer);...

  • My if/else statement wont run the program that I am calling. The menu prints but once...

    My if/else statement wont run the program that I am calling. The menu prints but once I select a number the menu just reprints, the function called wont run. What can I do to fix this probelm? #include <iostream> #include "miltime.h" #include "time.h" #include "productionworker.h" #include "employee.h" #include "numdays.h" #include "circle.h" using namespace std; int main() { int select=1;     while (select>0) { cout << "Option 1:Circle Class\n"<< endl; cout << "Option 2:NumDay Class\n" << endl; cout <<"Option 3:Employee and Production...

  • I am trying to write this code which asks "Write a program that ask the user,...

    I am trying to write this code which asks "Write a program that ask the user, the question: What is a^b? //The program generates two signed integers and gives the user four attempts to get the correct answer //a=- , b = + //a= + , b = - " So far this what I wrote. I am not sure how to do this correctly. #include<iostream> #include<cstdlib> #include<ctime> using namespace std; int main() {    srand(time(0));    int guess,a,ans,b, k;...

  • Program is in C++, program is called airplane reservation. It is suppose to display a screen...

    Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...

  • I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for.....

    I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for..while..do while,loops,pointer,address,continue,return,break. Create a C++ program which contain a function to ask user to enter user ID and password. The passwordmust contain at least 6 alphanumeric characters, 1 of the symbols !.@,#,$,%,^,&,* and 1 capital letter.The maximum allowable password is 20. Save the information. Test the program by entering the User ID and password. The...

  • c++, I am having trouble getting my program to compile, any help would be appreciated. #include...

    c++, I am having trouble getting my program to compile, any help would be appreciated. #include <iostream> #include <string> #include <string.h> #include <fstream> #include <stdlib.h> using namespace std; struct record { char artist[50]; char title[50]; char year[50]; }; class CD { //private members declared private: string artist; //asks for string string title; // asks for string int yearReleased; //asks for integer //public members declared public: CD(); CD(string,string,int); void setArtist(string); void setTitle(string); void setYearReleased(int); string getArtist() const; string getTitle() const; int...

  • im writing a c++ code and getting stuck on two parts. The first part, when I...

    im writing a c++ code and getting stuck on two parts. The first part, when I go to write the customer order out to the file, it writes everything but the price out right. I'll get a weird number like 5.95828e-039 or nan. When I printout to the console it works fine so not sure what's wrong. Second After I write the order out to the file, I then have to go in and read the file and calculate the...

  • Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth ,...

    Need to write a program in Visual Studio CLR CONSOL APPLICATION for date of birth , addition , substraction . After perfoming additon, there should be an statement " do you wish to continue ? Press Yes to continue or E to exit. Once YES is pressed , then substraction followed by date of birth. If exit is presses then the screen should get closed. i have written a program , so please update that #include "stdafx.h" # include <iostream>...

  • C++ programming I need at least three test cases for the program and at least one...

    C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...

  • Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2...

    Problem with C++ program. Visual Studio say when I try to debug "Run-Time Check Failure #2 - Stack around the variable 'string4b' was corrupted. I need some help because if the arrays for string4a and string4b have different sizes. Also if I put different sizes in string3a and string4b it will say that those arrays for 3a and 3b are corrupted. But for the assigment I need to put arrays of different sizes so that they can do their work...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT