#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::string;
using std::cin;
int main()
{
srand(static_cast<unsignedint>(time(0)));
string firstName, lastName, age, phone, bikeSize, brand;
int position = rand(), gameCompletions = 0;
char choice, tutorial_continue;
system ("TITLE mx career!!");
cout << "\t\t\t\t mx career";
cout << "\n\n\nwelcome to your motocross career. here you will make choices depending";
cout << "\non what you think is best. but before you begin we will need you to fill";
cout << "\nout this survey..\n\n";
/*survey*/
cout << "\t\t\t\tsurvey";
cout << "\n\nFirst name:\n";
cin >> firstName;
cout << "last name:\n";
cin >> lastName;
cout << "age:\n";
cin >> age;
cout << "phone #\n";
cin >> phone;
cout << "bike size. (enter 'a' for 250 or 'b' for 450):\n";
cin >> choice;
switch (choice)
{
case'a':
bikeSize = 250;
break;
case'b':
bikeSize = 450;
}
cout << "bike brand(a = kawasaki, b = ktm, c = honda, d = suzuki, e = gasgas, f = yamaha)";
cin >> choice;
switch (choice)
{
case'a':
system("COLOR A");
brand == "kawasaki";
break;
case'b':
system("COLOR C");
brand == "ktm";
break;
case'c':
system("COLOR 4");
brand == "honda";
break;
case'd':
system("COLOR E");
brand == "suzuki";
break;
case'e':
system("COLOR F4");
brand == "gasgas";
break;
case'f':
system("COLOR 9");
brand == "yamaha";
break;
}
cout << "\nonce you have completed the game you will be able to create your own race team\n";
cout << "note:once you quit the game your data will not be saved\n";
cout << "\nso what do you want to do first??? \n(a = play game or b = cheat)";
cin >> choice;
switch (choice)
{
case'a':
break;
case'b':
string cheat;
cin >> cheat;
if (cheat == "speedy gonzales")
{
cout << "you are a big fat cheater, but i guess i can make an exception if you do it for speed\n";
}
elseif (cheat == "make it rain")
{
cout << "anything for money...";
}
}
/**********************************************CLASSES***********************************/
class bike
{
public:
int speed;
int breaking;
void broken()
{
position = position - 18;
cout << "OH NO!!!! YOUR BIKE BROKE!!!!!!!!!!";
}
};
}
The class is undefined because you didn't declare it. You're defining the class AFTER instantiating it. Does that make sense to you? Either put it above the main function, or put it in a separate file. As far as the undefined INT goes, it's undefined because it's out of scope. You can't declare a variable in one function and use it in a scope where it isn't defined yet. If you want to use position, declare it in the class or pass it to the function.
How the hell do you learn about classes before function parameters?
Also, ascii, because using the entire standard namespace wastes resources. In a small program like this, it isn't that important, but I've made a habit of doing it because it's bad practice to include an entire namespace.