Started 1 week, 1 day ago (2009-11-30 22:17:00)
by MaHuJa
The only reason I see for using a pointer, is if you intend to use a buffer to store all the
factorials found. The rest of this section is written with that in mind.
The error is extremely obvious - to any slightly trained eye.
long *result; // Points where?
*result = 1; // Writes to arbitrary, uncontrolled location. The best that can happen is a crash.
A good ...
Started 5 days, 10 hours ago (2009-12-04 06:33:00)
by dude_89
Started 1 week, 2 days ago (2009-11-30 05:03:00)
by MaHuJa
Argh... I intended to add a new reply to my old one, but ended up editing it instead, so it made little sense. Stand by.
Started 1 week ago (2009-12-02 09:06:00)
by MaHuJa
Started 5 days, 13 hours ago (2009-12-04 04:03:00)
by AlkappyRapsok
Started 1 week, 4 days ago (2009-11-27 21:07:00)
by MaHuJa
When your main() calls setvalue(5); that's totally unrelated to the code you wrote above it. You need to create a classname object to run it on.
Btw,
dev-cpp uses an ancient compiler that you really shouldn't be using, at least as a beginner.
Started 5 days, 7 hours ago (2009-12-04 09:21:00)
by MaHuJa
Started 6 days, 10 hours ago (2009-12-03 06:16:00)
by MaHuJa
Started 1 week, 1 day ago (2009-12-01 14:29:00)
by jpet32
Started 3 weeks, 6 days ago (2009-11-12 12:30:00)
by MaHuJa
See http://www.cppreference.com/wiki/st.../random_shuf
fle
For example, if you have them in a vector<int> v; then the line
random_shuffle(v.begin(),v.end());
will do that.