guessing game

Hello, i new to C++ and trying to learn some things on my own. I'm trying to construct a random number guessing game. i think i got most of the codeing correct but now my form want debug(run), please help! when i build , i get no errors

Here the code:

private: System::Void BtnClear_Click(System::Object^ sender, System::EventArgs^ e) {



this->lblCorrect->Visible = false;
this->lblTooLow->Visible = false;
this->lblTooHigh->Visible = false;
this->btnClear->Visible = false;
this->btnEvaluate->Visible = true;
this->btnEvaluate->Focus();


}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
#include <iostream>
#include <cstdlib>
#include <ctime>
#pragma once
using namespace std;
int main ()
{
int number = 0;
int guess = 0;
int numOfGuesses = 0;
int minRand = 0;
int maxRand = 100;
int sum = 0;
srand(time(0));
number = (rand() % (maxRand-minRand)) + minRand;
cout << "The random number is: " << number <<endl;
sum += numOfGuesses;
return(0);
}

}
private: System::Void btnEvaluate_Click(System::Object^ sender, System::EventArgs^ e) {

if (guess == number)
this->lblCorrect->Visible = true;
MessageBox::Show("You are right!!", "It too you << sum << guesses.");
else if (guess < number)
this->lblTooLow->Visible = true;
else
this->lblTooHigh->Visible = true;
this->btnClear->Visible = true;
this->btnClear->Focus();
this->btnEvaluate->Visible = false;


}

Topic archived. No new replies allowed.