CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: test

  1. #1
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    test

    The colour coding is done by msvc not me

    This is exactly how it pastes from msvc9 and I swear it doesn't look like that in the compiler.

    Code pasted from msvc7.0
    Code:
    #ifndef SEQUENCE_H
    #define SEQUENCE_H
    
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    Same code pasted from msvc9 express.
    Code:
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  2. #2
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: test

    The colour coding is done by msvc not me

    This is exactly how it pastes from msvc9 and I swear it doesn't look like that in the compiler.

    Code pasted from msvc7.0
    Code:
    #ifndef SEQUENCE_H
    #define SEQUENCE_H
    
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    Same code pasted from msvc9 express.
    Code:
    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"
    
    namespace GT
    {
        template < uint N >
        class Sequence
        {
            private:
                IntVec sequence_;
    
                Sequence( const Sequence& );          
                Sequence& operator =( const Sequence& );
    
            public:
                Sequence()
                {
                    sequence_.reserve( N );
                    for ( int i = 1; i <= N; ++i )
                    {
                        sequence_.push_back( i );
                    }
                    Shuffle();
                }
                                          
                const IntVec& GetSequence() const
                {
                    return sequence_;
                }
    
                static void Randomize( uint def = 0 )
                {
                    if ( def == 0 )
                        def = static_cast<uint>( std::time( NULL ) );
                    std::srand( def );
                }
                
                void Shuffle()
                {
                    std::random_shuffle( sequence_.begin(), sequence_.end() );
                }
        };
    
    } // end namespace
    
    #endif // header guard
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  3. #3
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: test

    #ifndef SEQUENCE_H
    #define SEQUENCE_H
    #include<algorithm>
    #include<ctime>
    #include<cstdlib>
    #include<cstdio>
    #include"typedefs.h"
    namespace GT
    {
    template < uint N >
    class Sequence
    {
    private:
    IntVec sequence_;
    Sequence(
    const Sequence& );
    Sequence&
    operator =( const Sequence& );
    public:
    Sequence()
    {
    sequence_.reserve( N );
    for ( int i = 1; i <= N; ++i )
    {
    sequence_.push_back( i );
    }
    Shuffle();
    }

    const IntVec& GetSequence() const
    {
    return sequence_;
    }
    staticvoid Randomize( uint def = 0 )
    {
    if ( def == 0 )
    def =
    static_cast<uint>( std::time( NULL ) );
    std::srand( def );
    }

    void Shuffle()
    {
    std::random_shuffle( sequence_.begin(), sequence_.end() );
    }
    };
    }
    // end namespace
    #endif// header guard
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  4. #4
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: test

    #ifndef SEQUENCE_H
    #define SEQUENCE_H

    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"

    namespace GT
    {
    template < uint N >
    class Sequence
    {
    private:
    IntVec sequence_;

    Sequence( const Sequence& );
    Sequence& operator =( const Sequence& );

    public:
    Sequence()
    {
    sequence_.reserve( N );
    for ( int i = 1; i <= N; ++i )
    {
    sequence_.push_back( i );
    }
    Shuffle();
    }

    const IntVec& GetSequence() const
    {
    return sequence_;
    }

    static void Randomize( uint def = 0 )
    {
    if ( def == 0 )
    def = static_cast<uint>( std::time( NULL ) );
    std::srand( def );
    }

    void Shuffle()
    {
    std::random_shuffle( sequence_.begin(), sequence_.end() );
    }
    };

    } // end namespace

    #endif // header guard
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  5. #5
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: test

    #ifndef SEQUENCE_H
    #define SEQUENCE_H

    #include <algorithm>
    #include <ctime>
    #include <cstdlib>
    #include <cstdio>
    #include "typedefs.h"

    namespace GT
    {
    template < uint N >
    class Sequence
    {
    private:
    IntVec sequence_;

    Sequence( const Sequence& );
    Sequence& operator =( const Sequence& );

    public:
    Sequence()
    {
    sequence_.reserve( N );
    for ( int i = 1; i <= N; ++i )
    {
    sequence_.push_back( i );
    }
    Shuffle();
    }

    const IntVec& GetSequence() const
    {
    return sequence_;
    }

    static void Randomize( uint def = 0 )
    {
    if ( def == 0 )
    def = static_cast<uint>( std::time( NULL ) );
    std::srand( def );
    }

    void Shuffle()
    {
    std::random_shuffle( sequence_.begin(), sequence_.end() );
    }
    };

    } // end namespace

    #endif // header guard
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

  6. #6
    Join Date
    Sep 2008
    Posts
    15

    Re: test

    And yes, that is English for the UK'er, Aussies and Canadian not American
    Next time of use, please be careful with the language

  7. #7
    Join Date
    Jun 2008
    Posts
    37

    Re: test

    Quote Originally Posted by Marie Mih View Post
    And yes, that is English for the UK'er, Aussies and Canadian not American
    Next time of use, please be careful with the language
    I don't know about Brad, I guess Brad is an Australian Canadian man living in Ilionois
    Marie - Superstar, you so hillarious

  8. #8
    Join Date
    Sep 2000
    Location
    Indianapolis
    Posts
    6,758

    Re: test

    And this is what happens when you cut and paste someone else's post and put your own name on it.....

    (and I'm in Indiana, not Illinois )
    -----------------------------------------------
    Brad! Jones,
    Yowza Publishing
    LotsOfSoftware, LLC

    -----------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured