thekashyap 193 Practically a Posting Shark

There are a few problems with the existing code itself:
1. Requirement says "void getScore()-should ask the user for a test score, store it in a reference parameter variable,"
=> This is not done. So teh values updated within the function won't be reflected in main.
2. Usually it's a better idea to use an array of 5 elements instead of 5 int variables. So if you have already learned arrays you should use that.


Coming to the min/max part. Well you need to figure out which variable holds the min value. Try and write down a small algo in english to find this out.
Anyway before you come to this part I would say you tell us if you can use an array or not, things will depend on it.

thekashyap 193 Practically a Posting Shark

>> You are given an array of length N, which contains values in the range from 0 to (N^2) - 1. You are to sort it in O(N) time.

2 questions to understand the question:

1. Why does the range of value matter? (size/range of value would have no impact on the order of algorithm from what I know)
2. When you say "in O(N) time" do you mean it's an algorithm of order N or you really mean some number of mili/micro/seconds.. ?

thekashyap 193 Practically a Posting Shark

First the code won't compile due to This line:
=> char name[rows][columns];

Have a look at this and this.

thekashyap 193 Practically a Posting Shark

>>Now I checked the link you posted and there not a single way that can actually generate 100 different random sequences !
What do you mean by that? Simply seed the random number generator as shown in the article, and then go ahead and generate your random numbers. You'll still have to search the array to check that the number isn't already taken, but that's expected.

What was meant is there is no code that can generate 100x4 different seeds (which is what I did using Sleep(1)).
Anyway, it's actually not needed to generate 400 unique seeds like AD mentioned above just seed it once and keep using rand().

>>Is there another way? (apart from the one I gave in my second example)
I'm with Salem on this one. Filling up the array with sequential numbers, and then using std::random_shuffle to mix them up like vijayan121 suggested is probably the easiest way.

That's what my second example also does. :) std::random_shuffle is surely the simpler/easier way though..

thekashyap 193 Practically a Posting Shark

What's this supposed to mean? Random has nothing to do with the speed of your machine...

It does if you use time(0) as seed for srand().
The problem is that you need to come up with 100 different random series with a single call to your program. (not running it multiple times).
Issue is in coming up with 100 different seeds.
This is exactly what I've 'solved' using "Sleep(1) + seed(time(0)" in first example and "static long seed = time(0) ; + srand( (seed += time(0)) ) ;" in second. (and what JP called "simply horrid")

Simply horrid. There are better ways of generating random numbers than making the machine sleep.
http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx

Indeed it is. :)
But then 1. It solves the problem 2. There is no performance requirement. and 3. I have given another way in second example.
Anyway, it's interesting that you posted this link because while I was just fiddling with the code I posted I had checked a few links to find a simple way to solve the problem.
Now I checked the link you posted and there not a single way that can actually generate 100 different random sequences ! Is there another way? (apart from the one I gave in my second example)

thekashyap 193 Practically a Posting Shark

:)

thekashyap 193 Practically a Posting Shark

There are other problems..
"Generate 100x4 unique arrays" even rand() won't exactly be rand() if you have a fast enough machine..

Here is one way:

void fill_array( int* arr, const int len, const int max )
{
    vector<int> vi ; //or use set if you like..
    srand(time(0)) ;
    int tmp ;
    while( vi.size() < len )
    {
        tmp = rand() % (max+1) ;
        if( vi.end() == find(vi.begin(), vi.end(), tmp ) )
            vi.push_back(tmp) ;
    }
    memcpy( (void*)arr, (const void*)(&vi[0]), sizeof(int)*len) ;
}

void print_arr( int* arr, int len )
{
    for( int i = 0; i < len; i++ )
        cout << arr[i] << ' ' ;
}

int main()
{
    int a10[10], a50[50], a100[100], a200[200] ;

    for( int i = 0; i < 100; i++ )
    {
        Sleep(1000) ; //without this all 100 times a10 will be filled
                             //with same sequence as we do srand(time(0));

        fill_array( a10, 10, 9 ) ;
        cout << endl << "-----a10-----" << endl ; print_arr( a10, 10 ) ;

        fill_array( a50, 50, 49 ) ;
        cout << endl << "-----a50-----" << endl ; print_arr( a50, 50 ) ;

        fill_array( a100, 100, 99 ) ;
        cout << endl << "-----a100-----" << endl ; print_arr( a100, 100 ) ;

        fill_array( a200, 200, 199 ) ;
        cout << endl << "-----a200-----" << endl ; print_arr( a200, 200 ) ;
    }
    return 0;
}

Then again there are other solutions:
Given the problem stmt:
1-100 arrays of size 10 with randomly distinct numbers from …

thekashyap 193 Practically a Posting Shark

It surely is UNICODE problem like Salem mentioned, search msdn.microsoft.com to find out how to write UNICODE compatible programs and what are the relevant project settings. You'll learn how to change your project settings AND how to change the code if you don't want it UNICODE compat..
From what I remember from my ancient times is you need to #define UNICODE 1 (but that seems to have already been done !)

thekashyap 193 Practically a Posting Shark

I reused your code but I think ( I know there is a mistake somewhere) I didn't get it worning properly

Here is code as I have it

try
{
    // String storing the command to be executed
       String lCmdStrStr = "C:/WINDOWS/system32/cmd.exe";
        Process lChldProc = Runtime.getRuntime().exec(lCmdStrStr);
        
        BufferedWriter lPout = new BufferedWriter(new OutputStreamWriter(lChldProc.getOutputStream()));
        String getDir = "cd C:/Temp";
    lPout.write( getDir, 0, getDir.length()-1);
        lPout.flush();
    String delCom = "del *.tif";
    lPout.write( delCom, 0, delCom.length()-1);
    lPout.flush();
    lPout.close();
            
    // Wait for the child to exit
    lChldProc.waitFor();
    BufferedReader lChldProcOutStream = new BufferedReader(new InputStreamReader(lChldProc.getInputStream()));
    String lChldProcOutPutStr = null;
    while ((lChldProcOutPutStr = lChldProcOutStream.readLine()) != null)
    {
        System.out.println(lChldProcOutPutStr);
    }
    lChldProcOutStream.close();
}
catch(Exception e)
{
    e.printStackTrace();
}

but it does not delete tif files from directory. System.out.println(lChldProcOutPutStr); only print out C:\Project\EDMA>More? what is project directory and More? which is related to cmd not understanding my command

Can you please let me know what I'm doing wrong?
Thank you
Peter

I think this is your problem is the command:

String lCmdStrStr = "C:/WINDOWS/system32/[B]cmd.exe[/B]";

PS: I've never used Runtime on windows. Problem is you're trying to use a built-in command of cmd.exe instead of a seperate command which has an executable of it's own.

Anyway your problem is that when you run cmd.exe you see the prompt ! (that "C:\Project\EDMA>" is the command prompt where cmd.exe, the child process, is waiting for you to type commands.)
There are 2 ways of doing this: easy and hard. :)
Hard way is connect to the lChldProc.getInputStream() and write your …

thekashyap 193 Practically a Posting Shark

is there a way to delete this thread?

You, I doubt it.. in any case Moderator can do it and I hope he doesn't for other sake.. sorry..

thekashyap 193 Practically a Posting Shark

Well, I can't. Anyway it's not encouraged to chat elsewhere so that solutions can remain here..
I'll try to explain once more:
If you do Runtime.exec("dir"); in your code and run it, you will NOT see the directory listing prited by dir command, this is because of the way Runtime executes the command.
To execute a given command Runtime creates a child process and creates an OutputStream object that is attached to this child process's output file descriptor/stream. So whatever is prited out by the command goes to this stream object and not on the console where you are running your java program.
So finally to get what was printed by your command, you need to read from that OutputStream and print whatever you read using System.out.println().
Here is the sample code doing exactly what I explained above:

// String storing the command to be executed
String lCmdStrStr = lStrBuf.toString();
sLogObj.writeLog(sLogObj.INFO,"JTrcMgrAnalyzeCom -> Executing: "+lCmdStrStr);
Process lChldProc = Runtime.getRuntime().exec(lCmdStrStr);

// Wait for the child to exit
lChldProc.waitFor();
BufferedReader lChldProcOutStream = new BufferedReader(new InputStreamReader(lChldProc.getInputStream()));
String lChldProcOutPutStr = null;
while ((lChldProcOutPutStr = lChldProcOutStream.readLine()) != null)
{
    System.out.println(lChldProcOutPutStr);
}
lChldProcOutStream.close();
thekashyap 193 Practically a Posting Shark
public class Main
{
    public static void main(String args[ ])
    {
        String word = "abcdefghijklmnopqrstuvwxyz0123456789";
        System.out.println(jumbleIterative(word));
        System.out.println(jumbleRecurse(word, word.length()));
    }

    public static String my_swap( String str, int to, int from ) {
        StringBuilder newWord = new StringBuilder(str);
        char temp = newWord.charAt(from);
        newWord.setCharAt(from, newWord.charAt(to));
        newWord.setCharAt(to, temp);
        return newWord.toString();
    }

    public static String jumbleIterative(String word)
    {
        for(int i = 0; i < word.length(); i++)
        {
            word = my_swap(word, (int) (Math.random() * word.length()), i) ;
        }
        return word;
    }
    
    public static String jumbleRecurse( String str, int index ) {

        if( index != 0 ) {
            str = jumbleRecurse( str, --index ) ;
        }
        return my_swap ( str, (int) (Math.random() * str.length()), index ) ;
    }
}
thekashyap 193 Practically a Posting Shark

Length of the string you pass down the recusive call chain won't change (should not change).
What should change is "what is changing in your for loop in iterative model" viz. index of character on which you're working.
So pass the index of character on which the function is supposed to work along with String on which it has to work. Inside the function the condition would be to check if this index has reached it's limit (0 or string.length() depending on whether you're recursing to or fro the end of string) instead of "word.length() == 1"

thekashyap 193 Practically a Posting Shark

Hope things are clear from comments in the code..
Ignore the part where password is passed to child proc (in my case the command that I execute using Runtime.exec() expects a password to be input by user on command line).

// String storing the command to be executed
String lCmdStrStr = lStrBuf.toString();
sLogObj.writeLog(sLogObj.INFO,"JTrcMgrAnalyzeCom -> Executing: "+lCmdStrStr);
Process lChldProc = Runtime.getRuntime().exec(lCmdStrStr);
// Sending the password to the perl script
if(lNeedFtpBool)
{
    BufferedWriter lPout = new BufferedWriter(new OutputStreamWriter(lChldProc.getOutputStream()));
    lPout.write(lMypwdStr);
    lPout.flush();
    lPout.close();
}
// Wait for the child to exit
lChldProc.waitFor();
// Get the exit status of the child process
int lStatIntInt = lChldProc.exitValue();
BufferedReader lChldProcOutStream = new BufferedReader(new InputStreamReader(lChldProc.getInputStream()));
String lChldProcOutPutStr = null;
while ((lChldProcOutPutStr = lChldProcOutStream.readLine()) != null)
{
    System.out.println(lChldProcOutPutStr);
}
lChldProcOutStream.close();
//*************************************************************************************
// After checking the return code from the child proc, print a shell window msg
// indicating the success or failure
//*************************************************************************************
if( lStatIntInt != 0)
{
    // Print a shell window message indicating the failure
    System.out.println("Error  : Failed to execute the analyze command. Please try again.");
    sLogObj.writeLog(sLogObj.INFO,"JTrcMgrAnalyzeCom -> Failed to exec the analyze cmd, exit code of child is:"+lStatIntInt);
}
thekashyap 193 Practically a Posting Shark

so you don't have to moke me

That sure wasn't the intention. What was meant is "if you don't care [whether your program runs on Unix or not]...". Which could simply be due to requirements.

Anyway, just remembered that Runtime would create some streams (for input, output and error streams of the newly created process using exec()). You'll have to read (writing is not needed in your case) from this stream and print out all that's read. Then you'll have some errors to report. So in case your command "del C:\\Temp\\xyz" failed and printed out some errors you can read them from the stream that Runtime gives you.

I had some sample code, will dig it and post if I can find it.

thekashyap 193 Practically a Posting Shark

As it is in development all testing is done on my pc where I have all admin rights. Working with Windows XP...

If that's the case things should've worked. But you say it didn't. Post the errors you got (stack trace...).

Problem with Runtime.getRuntime().exec(string_cmd) ; is that string_cmd differs from platform to platform, so your program won't run on a Unix machine. That's why ppl say don't use it. If you don't care, go ahead and use it, just remember you're also missing on a learning opportunity.. :)

thekashyap 193 Practically a Posting Shark

Yes. Copy paste err..
So now I know you've understood for sure.. :)

thekashyap 193 Practically a Posting Shark

Correction for comment in get_good()

/*
    1 & X = X (where X = 0 or 1)
    0 & X = 0 (where X = 0 or 1)

    0x00 = 00000000
    0x08 = 00001000
 0x00 & 0x08 = 00000000

    0x08 = 00001000
    0x08 = 00001000
 0x08 & 0x08 = 00001000

    so if the 4th bit is set, flag & 0x08 evaluates to non-zero
    if 4th bit is set, flag & 0x08 evaluates to zero.
    0 converted to boolean is false
    non-zero converted to boolean is true
*/
thekashyap 193 Practically a Posting Shark

Something more than "This code wont run at all right now" would be helpful. :)
I don't see why you would want to keep resizeing your vector. It's simply not needed to start with. I would suggest just comment out that code, let vector resize by itself, later when things work you can optimize.
Anyway I don't think there is any issue with resize(). Also given the way you're storing teh data (vector<list<..>> ) I don't see any problems that your hash function can cause.
-------------
O now I saw your hashing code more closely. Well, given that you have done this:
output = (128*output + word) % 127;
It's always ensured that getHash() returns something between 0-127. So line 20 to 31 in your original code can be replaced by vtr.resize(128) ;

thekashyap 193 Practically a Posting Shark

1. I didn't know that binary searches work on un-sorted list.
2. For the last if thing not working I think it's a flushing problem try this:

if (arra[mid]!=num)
    //NOTE THE EXTRA flush AT END.
    //FYI endl = flush + "\n" (so that can also be used)
    cout<<"\nnot found" << flush ;
 else if (arra[mid]==num)
    cout<<"location is\t"<<mid;
 getch();
}
thekashyap 193 Practically a Posting Shark

It's hard to explain in precisely the given code. I need to know types and values of AFE_REG_FLAG_CDR and AFE_REG_FLAG_MSR. Also what're all these flags used for?

In general may be some example will help:
Say you have a class that reprents a file. An object of this would have many states. Say our object has following:
1. good - when this flag is 1 it means the object is good for usage.
2. eof - when this flag is 1 it means the file pointer is at the end of file.
3. bof - when this flag is 1 it means the file pointer is at the begenning of file.
4. error - when this flag is 1 it means that last operation performed (read/write/seek...) on file failed.
One of implementing this would be to use 4 booleans. Another is to use a single char variable (whose size say is 1 byte = 8-bits) and use 4 bits to represent these 4 flags (other 4 are ignored).
Say like this:

8    7    6    5    4    3    2    1
                    ^    ^    ^    ^
|<-- ignored-->|  good  err  eof  bof

Say in our class we provide 8 functions:
get_good(),set_good()
get_bad(),set_bad()
get_eof(),set_eof()
get_bof(),set_bof()
to get/set the values of these 4 flags.
Now if we had booleans: our function would look like this:

bool my_class::get_good() { return m_good_bool ; }
bool my_class::set_good(bool new_val) { m_good_bool = new_val;}
~s.o.s~ commented: Rep from ~s.o.s~, I like your way of teaching... :D +15
jaepi commented: nice one +1
thekashyap 193 Practically a Posting Shark

Did you read the articles I gave links to.. ?

thekashyap 193 Practically a Posting Shark

I feel you've got something mixed up in copying these 2 lines

#define FLAG_CDR 0*01 
#define FLAG_MSR 0*01

they should probably look somethig like:

#define FLAG_CDR 0x01 
#define FLAG_MSR 0x01

This defines both flags to be same.
Anyway, just lookup the articles on bitwise operators and this should be clear. Here is another one.

This code is just trying to set some part (bits) of the value of flags variable to 0 (turning it off).

thekashyap 193 Practically a Posting Shark

Here it's updated.. (See comments in code)

/*****************************************************
* COSC 230 - Structured Programming
* Chapter 6:  Programming Exercise 7
* Mar. 20, 2007
*
* Discription:
*    Determine population growth rate
*    Determine population after 'n' years
******************************************************/

//headerfiles
#include <iostream>
#include <string>

using namespace std ;

//function prototypes
int growthRate ( int, int ) ;
int estimatedPopulation ( int, int, int ) ;

int main()
{
    int population ;
    int cPopulation ;
    int birthRate ;
    int deathRate ;
    int n ;

    cout << "Enter the current population:  " << flush ;
    cin >> cPopulation ;
    if( cPopulation < 2 )
    {
        cout << "You have no hope.. !" << endl
            << "Current population must be at least 2 for natural human evolation.. :)" << endl ;
        return 1 ;
    }
    cout << "Enter the birth rate:  " << flush ;
    cin >> birthRate ;
    cout << "Enter the death rate:  " << flush ;
    cin >> deathRate ;
    cout << "Enter the number of years to calculate:  " << flush ;
    cin >> n ;
    if( ( birthRate <= 0 ) ||
        ( (deathRate <= 0) || (deathRate > 100) ) ||
        ( n <= 0 ) )
    {
        cout << "Birth rate, Death rate and Number of years must be greater than 0. And Death rate can't be greater than 100." << endl ;
        return 1 ;
    }

    /*
        NEW_P = P + (B*P/100 - D*P/100)
        ==> NEW_P = P + ((B - D) * (P/100)) …
thekashyap 193 Practically a Posting Shark

I think the error "error C2664: 'estimatedPopulation' : cannot convert parameter 1 from 'int (__cdecl *)(int,int)' to 'int'" is clear enough though.. just look at the first param..

thekashyap 193 Practically a Posting Shark

Line 27 and 28:

x = growthRate( birthRate , deathRate ) ;
population = estimatedPopulation ( growthRate , cPopulation, n ) ;

SHould either be:

x = growthRate( birthRate , deathRate ) ;
population = estimatedPopulation ( x, cPopulation, n ) ;

OR

//x = growthRate( birthRate , deathRate ) ;
population = estimatedPopulation ( growthRate(birthRate , deathRate), cPopulation, n ) ;
Duki commented: thanks for the help! -duki +1
thekashyap 193 Practically a Posting Shark
while ( !airportsMaster.eof())
{
    airportsMaster.getline(icaoChr, 5,',');
    for ( int i=0; i<(numAirports); i++ )
    {
        if (icaoChr == icaoStr[i])
        {
        airportsList << icaoStr[i] << ",";
        airportsMaster.getline(tempChr, 35,'\n');
        airportsList << tempChr << "\n";
        }
    }
    airportsMaster.ignore(35, '\n');
}

You have already extracted teh '\n' on line 10. It really isn't THAT obvious what the code is doing, but my guess is that line 13 should be in an else of the if inside for loop.

thekashyap 193 Practically a Posting Shark

A little more info would help, like what are you trying to do?? What is teh command you use to run and EXACT msg in the msg box...

thekashyap 193 Practically a Posting Shark

1. Give complete information. E.g. error msg (as printed on your console) so we know which line are we talking abt... ??
2. Is the error runtime or compile time??
3. Without that info all I can say/guess is there might be some unsatisfied linking kinda error. Assuming it's a runtime error of course. Hope you got it.. :)

I meant something like this.

thekashyap 193 Practically a Posting Shark

To detect the order you need some help from teh algorithm, no outside code can independencly establish that.
The order of the algorithm means how many operations would the algo perform to sort a list of 'n' elements.
Bubble sort is of order n*n (i.e. n-square).
Anyway, just increment a static variable within the code of 'operation' (in your case it's a 'swap', inside the while loop). At the end of the run the value of this variable will give you the order for a given sequence.
Remember this is different than the theoratical order. Anyway see this link.

thekashyap 193 Practically a Posting Shark
#include<iostream.h>
#include<conio.h>
void main()

{
    int x, y, c = 0;
    clrscr();

    cout<<"\nPrime Numbers upto 100 :\n ";

    for( x = 2; x < 100; x++ )
    {
        //check only odd numbers, even are never prime.
        if( x % 2 != 0 || x == 2 )
        {
            //if an odd number 'x' is divisible by any number between 2 and '(int)x/2' then it is NOT a prime number.

            for( y = 2; y <= x / 2; y++ )
            {
                //If 'x' is divisible by any number between 2 and x/2, loop will break BEFORE y is '>' x/2.
                //There is no point checking for numbers greater than x/2 as the possibility  of x being divisible 
                //by numbers greater than x is nil and 
                //by numbers between x and x/2 is same as x/2 and 2.
                 if( x % y == 0 )
                {
                    break;
                }
            }

           //If 'x' is divisible by any number between 2 and x/2, loop will break BEFORE y is '>' x/2.
            if( y > x / 2 )
            {
                cout<<"\n\t" <<x ;
                c++;
            }
        }
    }

    cout<< "\n \nTotal Prime No.: " << c ;
    getch();
}
thekashyap 193 Practically a Posting Shark

Seems like you're writing C code in some C++ IDE. (variables declared after function calls).
If this is for some small part of with some project of yours easiest would be to #include <algorithm> and use std::sort().
If this is some assignment you can either use what Luckychap posted (Bubble sort) or use some other more efficient sorting algorithms.

thekashyap 193 Practically a Posting Shark

>rectangle theRect2();
Be careful. This is not what you expect it to be.

Remove the parentheses, and the errors should go away.

So we do know the compilers.. Thanks. :)

thekashyap 193 Practically a Posting Shark

It's a bit strang, but you never know the compilers...
Try: rectangle theRect2;
Instead of: rectangle theRect2();

thekashyap 193 Practically a Posting Shark

Code is okay..
May be the pre-processor is screwing up somewehre. Do only preprocessing and check the output. Also hope that you've posted complete code.
Is the error in .cpp or .h? What compiler are you using?
Don't do "using namespace std;" in header file. You'll run into trouble when you code the clients of Account class.

thekashyap 193 Practically a Posting Shark

Could also use the buttons at right top (of the Quick Reply box) to increase the size of box, at least vertically, if your "quick reply" is growing beyond a few pages.. :)

thekashyap 193 Practically a Posting Shark

>> So shaving nanoseconds is important to a degree. Are virtuals really that bad?
Virtual functions will make a difference at nanosec level. But they improve maintainability many a times over.

>> UNTIL they hit certain objects.......type of object
You talked abt base class, and type of objects and certain type of objects, so I'm just a bit confused. Most common case in OOD is you have a function that is supposed to process different types of objects (derived class type), but work with only one type (base class type). If this is the situation it can't be solved using pp as you know the type only at runtime.
So I only hope you do have a situation where you're solving a problem using pp instead of virtual functions.

>>I'm having plans to limit their usage elsewhere... but that depends on benchmark result
Given that using pp instead of OOD to solve the problem will make things quite less maintainable, this is the only thing you can do, i.e. use OOD elsewhere.
Lastly in case you can already see impacts on this part of the code in future, I still suggest you reconsider and use virtual functions.

Your second post, I didn't get anything...

thekashyap 193 Practically a Posting Shark

I assume you have this one function which can convert a single character to a number. Say it is int convert_one_char(const char c).

Given this function here is the code to extend it to convert a string with multiple chars:

int convert_one_char(const char c)
{
    if( c == '0' ) return 0;
    else if( c == '1' ) return 1;
    else if( c == '2' ) return 2;
    else if( c == '3' ) return 3;
    else if( c == '4' ) return 4;
    else if( c == '5' ) return 5;
    else if( c == '6' ) return 6;
    else if( c == '7' ) return 7;
    else if( c == '8' ) return 8;
    else if( c == '9' ) return 9;
    else return -1 ;
}

long my_atoi( const string& s )
{
    int curr_dec_multiplier = 10 ;
    long ret_number = convert_one_char(s[s.length() - 1]) ;
    for( int i = s.length() - 2; i >= 0; i-- )
    {
        ret_number += convert_one_char(s[i]) * curr_dec_multiplier ;
        curr_dec_multiplier *= 10 ;
    }

    return ret_number ;
}

//------------------------------------------------

int main ()
{
    cout << "523623412 converted = " << my_atoi("523623412") << endl ;
    cout << "623412 converted = " << my_atoi("623412") << endl ;
    cout << "231 converted = " << my_atoi("231") << endl ;

    //-----------------------
    getch() ;
    return 0;
}
//------------------------------------------------

You'll need to put in appropriate error handling code...

thekashyap 193 Practically a Posting Shark

As long as both enums are NOT used within same switch-case there are no issues at all..

If you wish to use them in same switch-case you'll get the err that case value is repeated. So all you gotta do is decide on 2 ranges for both your enums and change the first value in enum declaration appropriately.

E.g.

const ENUM_ONE_START = 0 ;
const ENUM_TWO_START = ENUM_ONE_START + 100 ;

enum MenuOptionInitial { TEST_ONE = ENUM_ONE_START, TEST_TWO, TEST_THREE};
enum MenuSecond { TEST2_ONE = ENUM_TWO_START, TEST2_TWO, TEST2_THREE};
thekashyap 193 Practically a Posting Shark

>>if( FIVE_AM <= seconds_elapsed_today <= SIX_AM )
If you want to post code, please at least post valid code.

>>time_t seconds_elapsed_today = epoch_time % NUM_SEC_IN_A_DAY ;
Good idea :) , which I had thought of that too.

Sorry but I didn't get what's wrong with "if( FIVE_AM <= seconds_elapsed_today <= SIX_AM )" ?

thekashyap 193 Practically a Posting Shark

It may not be as simple as it sounds.
time() returns seconds elapsed since epoch. This means that 5am and 6am by themselves can not be compared with what is returned by time() because they are relative times. (relative to start of today).
So @n.aggel => what is the date associated with given 5am and 6am?
When you have the reference date you gotta convert that to format returned by time() and this will not be very small amount of code, may be 10-15 lines need to be written.
If you are sure that time returned by time() AND the 5am and 6am always belong to the same day then following code will work for your purpose:

const time_t NUM_SEC_IN_A_DAY = 24*60*60, FIVE_AM = 5*60*60, SIX_AM = 6*60*60 ;

time_t epoch_time = time(0) ;
time_t seconds_elapsed_today = epoch_time % NUM_SEC_IN_A_DAY ;

if( FIVE_AM <= seconds_elapsed_today <= SIX_AM )
     cout << "Current time is between 5 and 6 in morning." << endl ;
else
     cout << "Current time is NOT between 5 and 6 in morning." << endl ;