Question: 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
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
#include
#include
#include
using namespace std;
void showChoices()
{
cout << " MAIN 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 { dc*=10; i++; } myReadFile<<"name:"< 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"< for(i=0;i<4;i++) cout<<" ("< cout<<" (e)Non of the Above"; while(!flag&&attempt<3) { cout<<" Enter you Choice: "; cin>>ch1; for(i=0;i<4;i++) if(ch[i]==ch1) break; if(i==index) { d++; cout<<" Congrats Correct choice"; flag=true; } attempt++; } if(attempt==3) nc++; attempt=0;flag=false; if(i==index) myReadFile<<"Sum(X+Y) of"< else myReadFile<<"Sum(X+Y) of"< 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 { t=x; x=y; y=t;} cout<<"Subtraction of"< for(i=0;i<4;i++) cout<<" ("< cout<<" (e)Non of the Above"; while(!flag&&attempt<3) { cout<<" Enter you Choice: "; cin>>ch1; for(i=0;i<4;i++) if(ch[i]==ch1) break; if(i==index) { d++; cout<<" Congrats Correct choice"; flag=true; } attempt++; } if(attempt==3) nc++; attempt=0;flag=false; if(i==index) myReadFile<<"Subtraction of"< else myReadFile<<"Subtraction of"< break; default: cout << "Invalid input" << endl; } } myReadFile<<"Correct Answer:"< myReadFile.close(); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
