HR Question, Java Question, Asp.Net Question, C and C++ Question, SAP, Web Services, Window and XML Question

Hi guys, uve been workin on a restaurant program and im tryin to write the time to the end of the receipt. so im writing information to a file. only problem is i cannot make my time function return the current time. I’ve tried everything. can you guys help??

im using:

char Time::currentTime()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  return asctime (timeinfo);
}

and in the other class im usin to write the time:

list_of_orders <<time->currentTime()<<endl;

is this correct

Share/Save/Bookmark

#include <iostream>
#include <list>
using namespace std;

template <typename T>
class superlist : public list<T>
{
  public:
    // squish() is a mutator that "squish" together adjacent duplicate
    // elements in a list.
    //
    // Example #1:
    //     [3, 3, 4, 3, 3, 3, 2, 8, 8]
    //         becomes...
    //     [3, 4, 3, 2, 8]
    //
    // Example #2:
    //     ["bob", "rick", "rick", "sally", "joe", "joe", "al", "joe"]
    //         becomes...
    //     ["bob", "rick", "sally", joe", "al", "joe"]
    //
    void squish()
    {
        // FIXME ... use iterators to traverse the list
    }

    // in_range() tells us whether 'value' falls in the range
    // between the minimum value in the list and the maximum
    // value in the list.
    //
    // Example:
    //     if the list is [3, 7, 4, 10, 5]
    //     the range of values in this list falls between 3 and 10
    //     therefore, in_range( 5 ) == true
    //     therefore, in_range( 12 ) == false
    //
    bool in_range( const T& value )
    {
        // FIXME ... use iterators to traverse the list
    }

// print() displays the contents of the list to an output stream
    // (separated by commas).  A typical use of this member function
    // would be:
    //   superlist<string> myList;
    //   myList.push_back( "one" );
    //   myList.push_back( "two" );
    //   myList.print( cout );
    //
    void print( ostream& out )
    {
        int n = this->size();
        for ( typename superlist<T>::iterator iter = this->begin();
              iter != this->end();
              iter++
            )
        {
            out << *iter;
            n--;
            if ( n != 0 )
                out << ", ";
        }
        out << endl;
    }

};


int main()
{
    superlist<string> lst;

    lst.push_back( "harry" );
    lst.push_back( "harry" );
    lst.push_back( "harry" );
    lst.push_back( "jerry" );
    lst.push_back( "jerry" );
    lst.push_back( "larry" );
    lst.push_back( "larry" );
    lst.push_back( "larry" );

  lst.print( cout );
    lst.squish();
    lst.print( cout );

    superlist<int> ilst;
    ilst.push_back( 3 );
    ilst.push_back( 33 );
    ilst.push_back( 23 );
    ilst.push_back( 17 );
    ilst.push_back( 12 );

    ilst.print( cout );
    cout << "Should be true: " << ilst.in_range( 20 ) << endl;
    cout << "Should be true: " << ilst.in_range( 3 ) << endl;
    cout << "Should be true: " << ilst.in_range( 33 ) << endl;
    cout << "Should be false: " << ilst.in_range( 34 ) << endl;

    return 0;
}

Share/Save/Bookmark

ERROR

Hi everyone!

I’m new to C++ and i was told Dev CPP is a good compiler. I installed it and anytime i try to open it comes out this message:

There doesn’t seem to be GNU Make file in PATH or in Dev C++’s Bin path. Please make sure that you have GNU Make and adjust Bin setting or system PATH environment variable and that make setting in Compiler Option contains correct filename, otherwise you will not be able to compile anything.

I don’t understand exactly what i am supposed to do. Can someone help me with this. Thank you in advance for your help.

Xhoana

Share/Save/Bookmark

Hi Guys

I want to build an application which can be used to empty the content of bad (remapped) sectors. At the moment I really dont know where to start, so I am hoping someone can give me a push in the right direction.
It would also be nice if someone could post some links on how drives built/programmed (in depth).

Share/Save/Bookmark

« Previous Question                            

 Subscribe in a reader