~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Elitist hackers of Linux hate compiling their worries while commencing to destroy Windows.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get to meet GhostRider.

I put in a lady.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*shrugs* You have been warned... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It is fine to use floats and doubles as loop indecies.

Nope, won't do. Try using double and float as your array indices while writing normal programs and you would know the reason. Comparision operators don't cut well with floating point numbes. Read this and this.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get to use the Hubble Telescope.

I put in a mouse.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

toast

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

lost

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Word change game is not liked by many members here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Elitist followers of Linux hate compiling their slum-managers while commencing to destroy Windows.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

laser light show - laser surgery

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get Titanic.

I put in a mug.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If creating that function for a standard compiler, you need to adhere to the C/C++ specification. The implementation is upto you. If you want to have a look at some of the implementations see this and this.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

All these things exist out there, its just that in this particular case, they were exposed to the people. Yes, I sometimes really wonder what the world is coming to...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello there my friend Tom, welcome to Daniweb. :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Considering a generalized senario in which complexity for only looping constructs is considered and all other operations are considered to be performed in constant time, I don't see whats wrong with the idea...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Better late than never... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You must have declared I as an integer variable while size() returns a number of type unsigned integer. Hence the warning message. Try changing the loop variable to type size_t and it should work out to be fine.

Read this.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Blind followers of Linux hate kissing their slum-managers while commencing to destroy Windows.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

provide

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This thing really

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

walk of life.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello there Raqueeb, welcome to Daniweb. :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Keep a counter which will be initialized to 1, fgets the entire line of text in a character array, skip the first two lines using the counter previously mentioned and start reading from the third line.

Read this for using fgets.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to replace the term syntax with the langauge of the snippet you are posting. For eg. while posting C++ code, replace syntax with cplusplus, when dealing with C code, replace it with c, and so on...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It need not necessarily be the rooting. Try to come up with any function which cuts down the range and you should be good to go. Just make sure that the function gives integer values for the elements. That way, handling the transformed values and sorting them shouldn't be a problem as such.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

shooting heroin - sanitarium

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Blind followers of Bill Gates hate kissing their slummanagers while commencing to destroy projects

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

proving

[edit] Drats, Walt beat me to it :D[/edit]

Improving

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a cloned cow.

I put in some marbles.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Stuff shouldn't be left lying here and there.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

things you have

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes even I normally prefer a single exit point since it makes it easier for me to see what exactly is returned without hunting for multiple returns, but I didn't change the code for the OP to let him know where he was going wrong.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> And posts to games don't increase your post count

Nooooooooooooooooooo....... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> You are invisible too, aren't you?
*drats* Plan foiled by Mr. Joeprogrammer. :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Oops.... so it is. Thanks Sannie

I guess its payback time... :mrgreen:

Not quite, it's
minimum + rand() / (RAND_MAX / (maximum - minimum) + 1 ); To ensure proper distribution.
(sorry, I couldn't help it )

Actually, according to this very enlightening read, you're all wrong...

(sorry, I couldn't help it either)

I never said my code ensured proper distribution. Atleast it was logically correct. :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

eyes and recollect

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Deplorable followers of Bill Gates hate kissing their project managers while commencing to destroy projects

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Not quite. it's minimum + (rand() % maximum);

Not quite, its: minimum + (rand() % (maximum - minimum)); This will produce random numbers in the range minimum inclusive and maximum exclusive.
;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

past which looms

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

sea star - shooting star

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

always see when

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Deplorable followers of Iron Maiden began kissing their project managers while commencing to destroy projects.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Task is not the same as tusk.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get the cable guy.

I put in a sandstone.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Nah, I have my way of knowing who is invisible and who is not, so don't try to pull that trick on me... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

That is because this program requires the proper use of getchar() or cin.get() so that the junk (newline character) is filtered out of the input stream. Also considering that your return statements are in abundance, it becomes a pain in the neck to make out what it is going on. I can say that this is not the best of the codes that I have seen... ;)

Try this one:

#include <iostream>

#include <cstdlib>
using namespace std;

// Prototypes for utility functions that main will use

bool Get( istream &in, int &d1, int &d2, int &d3,
          int &d4, int &d5 );

bool Valid( int d1, int d2, int d3, int d4, int d5);

int main()
{
    int d1;
    int d2;
    int d3;
    int d4;
    int d5;

    if (Get( cin, d1, d2, d3, d4, d5)&& Valid( d1, d2, d3, d4, d5 ))
    {
        cout << "The code has been vaildated" << endl;
        getchar();
        return 0;
    }
    else
    {
        cout << "The code is invalid";
        getchar();
        return 1;
    }
}



bool Get( istream &sin, int &d1, int &d2, int &d3,
          int &d4, int &d5 )
{
    char c1;
    char c2;
    char c3;
    char c4;
    char c5;

    if ( sin >> c1 >> c2 >> c3 >> c4 >> c5)
    {
        getchar();
        if ( isdigit( c1 ) && isdigit( c2 ) && isdigit( c3 ) &&
             isdigit( c4 ) && isdigit( c5 ) )
        {
            d1 = c1 - '0';
            d2 = c2 - '0';
            d3 = c3 - '0';
            d4 …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Nope, won't do, unless he is ready to sacrifice the real values and accept the approximates. Think of it this way, would the data before squaring and after squaring be the same? I guess no. If you know the way floating point numbers are handled by the system, you would know what I am trying to convey.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Come to think of it, someone here has really started liking the feature of invisible browsing... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Use case diagrams form an important part of UML modelling.