You have 2 main() functions, 1 of them is embedded inside the other, that needs to be fixed. Also your gotoxy() func is embedded in a main() and needs to be its own function.
I'm guessing the you forgot 2 "}"s (1 to conclude the switch, 1 to conclude body of the main() that starts on line 9) around line 120.
void MyFunction()
{
int choice;
label:
cout << "Welcome to the menu";
cout << "Please choose a program" << "\n\n";
cout << "1. Do while loop" << "\n\n";
cout << "2. For loop" << "\n\n";
cout << "3. While loop" << "\n\n";
cout << "4. Gradenator" << "\n\n";
cout << "5. Gotoxy" << "\n\n";
cout << "\n\n";
cout << "Your choice here: ";
cin >> choice;
cout << "\n\n";
switch (choice)
{
case 1:
cout << "Please wait...";
cin.get();
system ("cls");
{
int x;
x = 4;
do {
x++;
cout << x << "\n";
} while (x > 2);
cin.get ();
}
break;
case 2:
cout << "Please wait...";
system ("cls");
{
for (int x = 1; x < 10; x *= 2)
{
Sleep (100);
cout << x << endl;
}
cin.get ();
}
cout << "\n\n";
cout << "Press enter to exit";
cin.get ();
system ("cls");
goto label;
case 3:
cout << "Please wait...";
system ("cls");
{
int x = 1;
while (x < 10)
{
cout << x << endl;
x++;
Sleep (100);
}
cin.get ();
}
cout << "\n\n";
cout << "Press enter to exit";
cin.get ();
system ("cls");
goto label;
case 4:
cout << "Please wait...";
system ("cls");
{
int mark, total;
float percent;
cout.setf(ios::fixed);
cout.precision(1);
system ("cls");
cout << "What mark did you get? ";
cin >> mark;
cout.width(23); cout << "What was it out of? ";
cin >> total;
percent = mark * 100.0 / total;
cout << "\nYour mark is " << percent << "%";
cout.width(30); cout<< "Goodbye!!\n\n";
cin.get();
}
cout << "\n\n";
cout << "Press enter to exit";
cin.get ();
system ("cls");
goto label;
case 5:
cout << "Please wait...";
system ("cls");
} //END switch()
} //END this function body.
//Below is a new function entirely, so it needs to be outside all other funcs.
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int main () //This is your "real" main function...
{
gotoxy(80, 1);
cout << "I am over here!!!";
//I'm guessing you meant to have this here...
MyFunction();
getch ();
return (0);
}
I'd also recommend moving the "cout << "Please wait..."; system("cls");" to right before your switch() statement, because it occurs in every one of your case labels.
And the code in your "case 1" section is not right. X starts at 4, so your loop will execute again and again (b/c 4 id > 2, and X gets increased each iteration) until it reaches the maximum possible value for an "int" which is system-specific but typically (2 ^ 32) - 1. After that iteration anything can happen happen b/c signed integer overflow is undefined.