Hi, this is my first post here. Hopefully you fine people could be of assistance. I'm somewhat of a newbie at C++; I just went to Borders and bought a book on it and I'm teaching myself along with a casual programming class at school (high school, that is; not in college yet).

I know this is overly complicated, but as long as it works I'll worry more about a simplified version later. I put it into codepad.org and it said "exit failure". Whenever I use my regular compiler (Dev CPP) to run it, it gives me no errors but closes instantly, despite my use of the system ("pause") statement. Any help?

The source code (don't judge me for my choice of words in cout sections ):
Code:
#include <iostream> 
#include <ctime> 
#include <cstdlib>

using namespace std;

int main() 
{ 
int t, l1, l2, l3, l4, l5, x1, x2, x0;
t = 1;

// Variables:
// L - Listed Item
//   l1 = unlimited
//   l2 = 10
//   l3 = 8
//   l4 = 5
//   l5 = 1
// X - User Input
//   x1 = List Selection
//   x2 = Guess
//   x0 = Try Again?
// t - Attempt Count

start: 

{  srand((unsigned)time(0)); 
    int random_integer, x; 
    int lowest = 1, highest = 1000; 
    int range = (highest - lowest) + 1; 
    for(int index=0; index<1; index++) { 
        random_integer = lowest+int(range * rand() / (RAND_MAX + 1.0)); 
        return random_integer;
  } 

cout << "--------------------------------------------------";
cout << "A number between 1 and 1,000 has been randomly " << endl;
cout << "generated. To play the game, type a number and press ENTER. " << endl;
cout << "The program will tell you to guess higher or lower. You " << endl;
cout << "may choose five options, as listed below. To begin the game, " << endl;
cout << "type the number of the option you want and press ENTER. " << endl;
cout << "Good luck! " << endl << endl << endl;
cout << "[1] Easy - Unlimited Guesses " << endl;
cout << "[2] Medium - 10 Guesses " << endl;
cout << "[3] Hard - 8 Guesses " << endl;
cout << "[4] Extreme - 5 Guesses " << endl;
cout << "[5] OMGWTF - 1 Guess " << endl;
cout << "[6] (sigh) - Infinite Guesses " << endl;
cout << "--------------------------------------------------";

cin >> x1;

list_error:

while ((x1 < 1) || (x1 > 6)) {
cout << "Please enter a number from 1-6. " << endl;
goto start;
}

//////////////////////////////////////
if (x1 == 6) {
	
x_6_retry:
	
	cout << "Enter your guess. " << endl;
	cin >> x2;
	if (x2 == rand()) {
		cout << "You win! " << endl;
		goto try_again;
	}
	else {
		while (x2 > rand()) {
			cout << "Guess a smaller number. " << endl;
		    goto x_6_retry;
		}
		while (x2 < rand()) {
			cout << "Guess a larger number. " << endl;
			goto x_6_retry;
		}
}

//////////////////////////////////////
if (x1 == 5) {
cout << "Enter your guess. " << endl;
cin >> x2;

if (x2 == rand()) { 
// replaced all a1s (now renamed x in return in the random number function) with rand().
cout << "You win! " << endl;
goto try_again;
}
else {
cout << "EPIC FAILSAUCE " << endl;
goto try_again;
}
}
else {
//////////////////////////////////////
if (x1 == 4) {
cout << "Enter your guess. " << endl;

x_4_retry:

cin >> x2;

while (x2 < rand()) {
cout << "Guess a larger number. " << endl;
goto x_4_retry;
++t;
}

while (x2 > rand()) {
cout << "Guess a smaller number. " << endl;
goto x_4_retry;
++t;
}

while (t > 5) {
cout << "EPIC FAILSAUCE " << endl;
cout << "The number was ";
cout << rand();
cout << " . " << endl;
goto try_again;
}
}
else {
//////////////////////////////////////
if (x1 == 3) {
cout << "Enter your guess. " << endl;

x_3_retry:

cin >> x2;

while (x2 < rand()) {
cout << "Guess a larger number. " << endl;
goto x_3_retry;
t++;
}

while (x2 > rand()) {
cout << "Guess a smaller number. " << endl;
goto x_3_retry;
t++;
}
while (t > 8) {
cout << "EPIC FAILSAUCE " << endl;
cout << "The number was ";
cout << rand();
cout << " . " << endl;
goto try_again;
}
}
else {
//////////////////////////////////////
if (x1 == 2) {
cout << "Enter your guess. " << endl;

x_2_retry:

cin >> x2;

while (x2 < rand()) {
cout << "Guess a larger number. " << endl;
goto x_2_retry;
t++;
}

while (x2 > rand()) {
cout << "Guess a smaller number. " << endl;
goto x_2_retry;
t++;
}

while (t > 8) {
cout << "EPIC FAILSAUCE " << endl;
cout << "The number was ";
cout << rand();
cout << " . " << endl;
goto try_again;
}
}
else {
//////////////////////////////////////
if (x1 == 1) {
cout << "Enter your guess. " << endl;

x_1_retry:

cin >> x2;

while (x2 < rand()) {
cout << "Guess a larger number. " << endl;
goto x_1_retry;
t++;
}

while (x2 > rand()) {
cout << "Guess a smaller number. " << endl;
goto x_1_retry;
t++;
}

while (t > 10) {
cout << "EPIC FAILSAUCE " << endl;
cout << "The number was ";
cout << rand();
cout << " . " << endl;
goto try_again;
}
}
else {
//////////////////////////////////////
goto list_error;
}
}
}
}
}

try_again:
cout << "Try again? Enter a 1 for yes or a 0 for no. " << endl;
cin >> x0;
if (x0 == 1) {
goto start;
}
else {
goto end_prgrm;
}

end_prgrm:
          
system ("pause");

return 0;
}
}
}
Yes, I handwrote the whole thing other than the random number function because I was lost with those.

Today, my programming class teacher gave us basically the same program without knowing I'm working on this and said it took him 10 minutes. I've probably spent 3-4 hours on this.