Im a beginner, and I have a problem dealing with random number game.
Im post to allow the user to have 10 tries before the game exits or restarts with another random number, but im having trouble figuring out how to do that.
Also, ive been trying to make a fuction for the code but its not coming out the way i planned.
Any help or tips will do, thanks. =]


Code:
/* 
 * File:   main.cpp
 * Author: Matthew
 *
 * Created on July 25, 2012, 12:55 AM
 */
#include <iostream>
#include <ctime>
#include <iomanip>
#include <cstdlib>
using namespace std;
int randomNum(int guess)
{
    srand(time(0));
    int rnum= rand()%5;
    char again = 'y';
    do
    {
        if (rnum < guess)
        {
            cout<<"Too low, Try again. ";
            cin>>guess;
        }
        else if (rnum > guess)
        {
            cout<<"Too high, Try again. ";
            cin>>guess;
        }
        else if ( rnum == guess)
        {
            cout<<"You have found the random number!";
        }
        else
        {
            cout<<"Would you like to play again? (y or n)"<<endl;
            cin>>again;
        }
    }while (again = 'Y' || again = "y");
    
}

int main(int argc, char** argv) {
    
    srand(time(0));
    int guess;
    cout<<"I have a number between 1 and 1000."<<endl;
    cout<<"Can you guess the number?"<<endl;
    cout<<"You will have a maximum of 10 guesses."<<endl;
    cout<<"Please try your first guess and good luck!"<<endl<<endl;
    cin>>guess;
    randomNum(guess);
    
    return 0;
}