这是我写的一段C++猜数字的程序,老师让我给改写成有CLASS格式的,我英文不好,英文书看不明白,求助
#include <iostream.h>
#include <cstdlib>
#include <time.h>
int main()
{
int myMax,secretNumber,i;
int t=0;
srand(time(0)); 
cout<<"input the myMax :";      //out a proper prompt message
cin>>myMax;                     //and input an integer into myMax
                  secretNumber=1+rand()%myMax;    // prescribe the secretNumber range 1<=r<=myMax    cout<<"please guess the number:";      
cin>>i;                                    if (i > secretNumber)
    cout << "Wrong! your number is bigger than the number i have.\n";
    else if (i < secretNumber)
    cout << "Wrong! your number is smaller than the number i have.\n";     while(i != secretNumber )         //the guess series starts
{  
cout << "Please guess again\n";
    cin >> i;
    if (i > secretNumber)
    cout << "Wrong! your number is bigger than the number i have.\n";
    else if (i < secretNumber)
    cout << "Wrong! your number is smaller than the number i have.\n"; 
    else cout << "Yes,you are right! You are very bright guy!\n";
t++;
    if (t>10)          //limit the guess times
{
    cout << "Do you kown the binary search?? you've not taken the course for Introduction to Computer Engineering!\n";
    break;          // out the series
}
}return 0;}
改写成有以下格式的:
class MyGames
{
public:
void treasureSearch()
{ }
private:
int secretNumber;
};//end of the class MyGamesint main()
{
}
我真的不怎么明白对于才学习C++的我,实在很痛苦,我在韩国但是看不懂书,真郁闷死了