One moment its working another I get a (LINK : error LNK2001: unresolved external symbol _mainCRTStartup) message. When it does work it executes the if statement whether or not the conditions have been met (for example if myPoints is less then the required amount). Where am I going wrong? When I copy this over into a new file, nothing is highlighted any more (comments aren't green, etc) and that's when I get the error message, any reasons for this
//This program is designed to use switch and function to get player input, then compare the input to the points required and display the appropriate message
#include <iostream
using namespace std;
int myPoints;
int main()
{
cout<<"Please enter your points: ";
cin>>myPoints;
cout<<"\nYou have "<<myPoints<<" resource points to spend on an upgrade"<<"\n";
cout<<"\nPlease select the ship you would like to upgrade to:\n";
cout<<"\n1 - Cruiser - 185 resource points\n";
cout<<"2 - Destroyer - 590 resource points\n";
cout<<"3 - Battleship - 1025 resource points\n";
int choice;
cout<<"\nChoice: ";
cin>>choice;
switch (choice)
{
case 1:
cout<<"\nYou picked the Cruiser class upgrade"<<"\n";
break;
case 2:
cout<<"\nYou picked the Destroyer class upgrade"<<"\n";
break;
case 3:
cout<<"\nYou picked the Battleship class upgrade"<<"\n";
break;
default:
cout<<"\nYou've made an invalid selection\n";
break;
}
if (choice=1==myPoints>=185)
{
cout<<"\nYou have enough points to purchase this upgrade";
}
else (choice=1==myPoints<185)
{
cout<<"\nYou still need "<<185-myPoints<<" to purchase this upgrade"<<"\n";
}
cout<<"\n";
if (choice=2==myPoints>=590)
{
cout<<"\nYou have enough points to purchase this upgrade";
}
else (choice=2==myPoints<590)
{
cout<<"\nYou still need "<<590-myPoints<<" to purchase this upgrade"<<"\n";
}
cout<<"\n";
if (choice=3=myPoints>=1025)
{
cout<<"\nYou have enough points to purchase this upgrade";
}
else (choice=3==myPoints<1025)
{
cout<<"\nYou still need "<<1025-myPoints<<" to purchase this upgrade"<<"\n";
}
cout<<"\n";
else
{
cout<<"No choice has been made";
}
cout<<"\n";
return 0;
Thank you very much I had used the AND operator where it was supposed to be but didn't switch the assignment op to the comparison, but I assumed it was the AND operator that was wrong. That's what I get for using something I hadn't studied yet.