Salem 5,265 Posting Sage

Everyone's doing it!

http://www.telegraph.co.uk/earth/environment/climatechange/7177230/New-errors-in-IPCC-climate-change-report.html

New examples of statements based on student dissertations, two of which were unpublished.

It's not like it's the first time either. Remember this one? That turned out so well in the end didn't it :icon_rolleyes:
http://en.wikipedia.org/wiki/Iraq_Dossier

that much of the work had been plagiarised from various unattributed sources.

Did I say end? Oh silly me, there will be no end to this fiasco.

What does seem to be common between them is the "sod the evidence, we know we're right because..." attitude of those publishing this propaganda.

Climate change isn't science, it's economics.
The first reason it's economics is that it's based on a whole mass of numbers(*) of dubious quality. Everybody and his dog has an opinion on what they all "might" mean, but essentially everyone is clueless in the long run.
The big advantage for CC "scientists" is that it might take 20 years before someone finally figures out that they're a charlatan. But hey, it won't matter by then, they've had one hell of a ride on the gravy train. Traditional economists are envious of this. It normally takes only a few years to discover that they've been blowing it out of their asses.

The second reason it's economics is that it gives governments an excellent "fear" stick to beat the populous with, and at the same time fleece them for more taxes.

Not to mention all the crooks moving in to …

Salem 5,265 Posting Sage

Initiatives are things typically started by governments because they want to be seen to be doing something.

But look closely at the root "init". It's only a start; they don't have the will or interest to take it through to the end.

Nick Evan commented: :) +12
Salem 5,265 Posting Sage

> I'm working on devcpp and it doesn't allow me to initialize with an integer number
That's because your target OS is Win32, and absolute addresses are completely meaningless in a virtualised address space.

Salem 5,265 Posting Sage

> I have tried using the exit() function to pass the sum back, but just keeps giving me 0 back as the exit status.
That's the result of the exec() call, not the result of the child process.

To get the result from the child, the parent uses one of the wait calls, then examines the resulting status value to get the exit status of the child.

But your spec said the child should also print things as well right?

Salem 5,265 Posting Sage

Well you could try indenting your code.

The last return 0; seems WAY WAY out of place...

Salem 5,265 Posting Sage

http://lmgtfy.com/?q=dbf+file+format
Then try "library" as another search term.

Salem 5,265 Posting Sage

> my question is what are the stop conditions of the ant colony system algorithm.
All the ants are dead.

Salem 5,265 Posting Sage

<vader>
I sense a presence in the source, a feeling that I've seen this .... before
</vader>

jonsca commented: My spidey senses were active too +2
Salem 5,265 Posting Sage

If you're on Linux,
http://valgrind.org/
http://perens.com/FreeSoftware/ElectricFence/
Both these help you to zero in on the cause of the problem, rather than the symptom.

Salem 5,265 Posting Sage
Ezzaral commented: ++ +10
Salem 5,265 Posting Sage

http://www.daniweb.com/forums/announcement8-2.html
Simply dumping your assignment isn't enough.

Salem 5,265 Posting Sage
#lqfoxgh <vwglr.k>
#lqfoxgh <fwbsh.k>
fkdu hqfubsw(fkdu fk) {
  li ( lvxsshu(fk) ) {
    fk = fk - 'D';
    fk = fk + 3;
    fk = fk % 26;
    fk = fk + 'D';
  } hovh {
    fk = fk - 'd';
    fk = fk + 3;
    fk = fk % 26;
    fk = fk + 'd';
  }
  uhwxuq fk;
}
fkdu ghfubsw(fkdu fk) {
  li ( lvxsshu(fk) ) {
    fk = fk - 'D';
    fk = fk - 3 + 26;
    fk = fk % 26;
    fk = fk + 'D';
  } hovh {
    fk = fk - 'd';
    fk = fk - 3 + 26;
    fk = fk % 26;
    fk = fk + 'd';
  }
  uhwxuq fk;
}

lqw pdlq ( ) {
  lqw fk;
  zkloh ( (fk=jhwfkdu()) != HRI ) {
    li ( lvdoskd(fk) ) {
      fk = hqfubsw(fk);
    }
    sxwfkdu(fk);
  }
  uhwxuq 0;
}

The code, run on itself.
Getting back would be easy, if only you had what I started with :twisted:

mitrmkar commented: Thanks for a good laugh ... +4
Salem 5,265 Posting Sage

> this is not homework but rather my work
I'm shocked that someone with a programming job can't solve this trivial problem :-O

Salem 5,265 Posting Sage

I said "close enough for you to make an attempt yourself".

Whining that the API you want doesn't exist in the form you want doesn't count. Have you studied the whole C++ bitmap API and related topics for an API which might do the same job?

This should be a minor obstacle, one that you've so far failed to show any sign of attempting yourself.

> If it is so easy - will you make translate the code to c++ for me
No.

Salem 5,265 Posting Sage

Use a while loop to read all keys, then sleep.

jonsca commented: Preemptive Answer Rep ;) (I know, I saw the other thread) +2
BestJewSinceJC commented: Can you tell me what the rest of this sentence .. +4
Salem 5,265 Posting Sage

> When you look at my output you can see the discrepancies start at the 50th element of the vector...
Yes, the code is still broken. You're returning a pointer to a local variable.
The result is that some of your data is trashed when that bit of the stack gets re-used for something else.

As this is C++, consider the following function prototype. void loadfile ( string filename, std::vector<double> &results );

Salem 5,265 Posting Sage

My forecast is that you didn't read this on your headlong rush to post as soon as possible.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Adding . to your PATH is a terrible idea!.


I'm joe hacker, and I've managed to create a short program called 'sl' in your world-writeable temp directory.
You lazily come along as root, and mis-spell 'ls' in an attempt to get a directory listing. You box is now mine.


Stick to ./program for running your local programs.

If you do create a program you want to keep, then create a $HOME/bin directory of your own, and put the file there. Add $HOME/bin to the end of your path, and make sure only you have access to your own bin directory.

And make sure the source for anything useful you create is safely stored somewhere :)

jonsca commented: Thanks. +2
Salem 5,265 Posting Sage

> This is one of those problem sets which prepares you for the job interviews.
After half a dozen clicks on that site (or should I say, "what a sight!"), it's disgusting what rubbish people spout as being good answers. There's no end of "Well my compiler does this, therefore it's the right answer".

Prepare - what a laugh.
Anyone armed with that information will either fail the interview or get confused on the first programming assignment.

WaltP commented: That site is certainly a laugh!!! +9
Salem 5,265 Posting Sage

> Write a program in c++ to swap 2 numbers without using a third variable.
The short answer is you can't, at least not in any way that is remotely useful.

For those suggesting addition, try this

#include <stdio.h>
#include <limits.h>

void f1 ( void ) {
  double a = 1E10, b = 1E-10;
  printf( "a=%.10f, b=%.10f\n", a, b );
  a = a + b;
  b = a - b;
  a = a - b;
  printf( "a=%.10f, b=%.10f\n", a, b );
  printf( "Oh dear, the tiny value got lost next to the huge value\n\n" );
}
void f2 ( void ) {
  int a = INT_MAX, b = INT_MAX - 1;
  printf( "%d %d\n", a, b );
  a = a + b;
  printf( "a is now %d - overflow\n", a );
  b = a - b;
  a = a - b;
  printf( "%d %d\n", a, b );
}

int main ( ) {
  f1();
  f2();
  return 0;
}

$ gcc foo.c
$ ./a.out 
a=10000000000.0000000000, b=0.0000000001
a=0.0000000000, b=10000000000.0000000000
Oh dear, the tiny value got lost next to the huge value

2147483647 2147483646
a is now -3 - overflow
2147483646 2147483647

So what you say, at least int eventually gave the right answer.
True, but only by luck rather than skill.

H.2.2 Integer types
1 The signed C integer types int, long int, long long int, and the corresponding
unsigned types are compatible with LIA−1. If an implementation adds support for the
LIA−1 exceptional values …

Dave Sinkula commented: Well said. +13
ChaseVoid commented: Detailed +3
Salem 5,265 Posting Sage

> I'm going from an earlier version to a new version of Visual Studio and the code has to still be compiled back on the old version.
And your question is what?
Did you read any of the thread, or did you just see the title and blast away?

Salem 5,265 Posting Sage

Why would a library management project NEED a graphics header file?

And no.
It seems obvious from your question that you found your homework answer on the web, except for the fact that it has a header file you don't have.

Hence the totally weird question about looking for the same thing, without a particular header.

So do you want to learn how to program, or just pass the class?

Salem 5,265 Posting Sage

First, INDENT your code.

#include<stdio.h>
main()
{
    int n = 0, i = 0, x = 0, ax = 0, bx = 0, cx = 0, dx = 0, ex = 0, fx =
        0, gx = 0, g[10], a[10], b[10], c[10], d[10], e[10], f[10];
    char r[10];
    printf("please enter the roman numeral :");
    scanf("%s", &r);
    for (; i < 10; i++) {
        switch (r[i]) {
        case 'I':
            a[ax] = i;
            ++ax;
            break;
        case 'V':
            b[bx] = i;
            ++bx;
            break;
        case 'X':
            c[cx] = i;
            ++cx;
            break;
        case 'L':
            d[dx] = i;
            ++dx;
            break;
        case 'C':
            e[ex] = i;
            ++ex;
            break;
        case 'D':
            f[fx] = i;
            ++fx;
            break;
        case 'M':
            g[gx] = i;
            ++gx;
            break;
        default:
            ;
        }
    }
    for (i = 0; r[i] != 0; i++) {
        x++;
    }
    n = 1000 * (gx);
    for (i = 0; i < fx; i++) {
        if (gx == 0)
            n = 500 * fx;
        else if (f[i] > g[gx - 1])
            n = n + 500;
        else
            n = n - 500;
    }
    for (i = 0; i < ex; i++) {
        if (gx == 0 & fx == 0)
            n = 100 * ex;
        else if (fx == 0 & gx != 0 & e[i] < g[gx - 1])
            n = n - 100;
        else if (fx == 0 & gx != 0 & e[i] > g[gx - 1])
            n = n + 100;
        else if (fx = !0 & gx == 0 & e[i] < f[fx - 1])
            n …
Dave Sinkula commented: Well said. +13
naveenreddy61 commented: thank you +0
Salem 5,265 Posting Sage

8 Judges on this forum have just given you a score of 1 (for effort).

jonsca commented: You should get little placard icons of numbers to go above every post! +2
Agni commented: lol :) +3
Salem 5,265 Posting Sage

> please let me know whether this method is correct or not.
You mean you can't tell?

Does it, or does it not output a list of prime numbers?

I'm sure it could be more efficient, but first you need to make sure it produces the right answers.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

.

> I have this assignment can anyone solve it?
I reject your reality (where you can expect free homework on a plate)
> Substitute your post contents into this reply.
and substitute my own (where you have to at least make an effort yourself)

.

Salem 5,265 Posting Sage

Read this, this, this, this, this and this.

Salem 5,265 Posting Sage

> because this is an excercise teacher gave me so i have to do it. thank 4 help.
Your teacher is an idiot. They probably no more understand the code than you do, since all they did was grab it from the ioccc site and hand it to you.

You're NOT going to learn how to program from them. Figuring out that code will tell you NOTHING (that's NOTHING!) about how to write a C program.
Real code produced by professionals in the real world looks nothing like that kind of crap.

Feel free to direct them to this forum.

Has this so-called 'teacher' told you at any time to use any of these?
- void main
- fflush(stdin)
- conio.h
- gets(buffer)
If the answer is "all of them", then be very afraid.
I'd be worried the the answer was even any of them.

Actually, you'd probably be better off failing/dropping the class than soaking up more broken information from them.

Salem 5,265 Posting Sage

http://www.independent.co.uk/opinion/commentators/johann-hari/johann-hari-the-age-of-the-killer-robot-is-no-longer-a-scifi-fantasy-1875220.html

> "You can't appeal to robots for mercy or empathy - or punish them afterwards"
But they are infinitely easier to re-program and send back. I'm sure a few hacked droids coming back which promptly explode will cause some pause.
Though no doubt the folly will be to "keep digging" rather than consider what kind of world is being created.

> "Some 4 per cent of US factories have "major robotics accidents" every year..."
How long before a real-life ED-209 moment?
This killing machine was built by the lowest bidder using the weakest design principles (aka the cheapest). Explain to me how that isn't going to result in 0 deaths, 0 injuries before it gets to the field because of malfunction.

In T2, there is the scene where the young John Connor quips "I guess skynet doesn't want you to do too much thinking", referring to the neural-net of the terminator being in "read-only" mode.
The same could be said of the DoD and CIA - not a whole lot of thinking going on there either.

Salem 5,265 Posting Sage

> I have got a C++ competition tomorrow and it is very important for me.
I :D
can't :D
stop :D
laughing!

"tomorrow" - oh the jollity.
The very idea that you could hope to learn enough to take on any random assignment like the ones you posted with only 24 hours "experience" is comical.

> guide me on how do I solve them so that I get some preparation for tomorrow
Problem solving is a skill acquired over many months and years.

This isn't the matrix, you're not going to be able to just download this and calmly announce "I know kung fu". Someone (tomorrow) will just say "show me" and you're toast.


If (and I do me IF) someone does post the answers, you're not going to get anywhere just from staring at the code. Even if you memorise it, it won't tell you anything about how to solve the next one.


Save yourself the embarrassment, and quietly drop out of the competition "for personal reasons". Anyone who is even remotely prepared for this (not you) is going to take it away.

Salem 5,265 Posting Sage

Post #12 is as close to an answer on a plate as you're likely to get.

If you can't see the answer from there, just give up at being a C++ programmer.

> why i would come here and bother u to fix such an error!
Because that code WAS CORRECT with an OLD C++ compiler, but it is broken for a NEW C++ compiler. The link I posted (assuming that you haven't read it) explains that (and the reason why).

> this is my work on lab session, i ddnt grab it from any website
> Date: Feb 09, 06
So you're 4 YEARS in the past are you?
Here's a tip for the up-coming financial disaster - sell property, buy gold, short-sell on banks.

> if u r not ready to help and guide others,
Oh please, just take a look around and figure out just how much help I actually give around here.
Your idea of "help" is something that will get you past the next assignment deadline without fixing any of the underlying problems in your knowledge.
My idea of "help" is to try to get you to work things out for yourself (with some nudging from us). But if you keep bleating "plz, it's too hard", then you're a lost cause.

tux4life commented: :) +7
Salem 5,265 Posting Sage
kvprajapati commented: Solved! +6
Salem 5,265 Posting Sage

As I thought

* Date:   [B]Feb 09, 06 [/B]                 File Name: Lab2.cpp
* Program Description:
*    A simple tictactoe game.

Not your code, you just grabbed it off the net, hoping it would fix your homework assignment, and now you want us to FIX IT FOR YOU without you spending any more effort.

tux4life commented: I've always liked your posts because they are built upon strong facts :) +7
Salem 5,265 Posting Sage

Why is declaring i a problem for you?

I mean, you've managed to get to "2 header files 3 cpp source files".
Unless it isn't actually your code at all....

phpangel commented: you should help members not crtitisize them +0
kvprajapati commented: True. It isn't his/her code. +6
Salem 5,265 Posting Sage

What does this crap have to do with C programming?
Try the lounge, or the gutter.

Salem 5,265 Posting Sage

> How might I began to program a text adventure/IF in Lua?
The same way you would in any other programming language.

There is so much more to writing a program than just figuring out the syntax of your current implementation language.
http://en.wikipedia.org/wiki/Software_development_process

There is no more a "how to write an adventure game" than there are "how to write a mobile phone" or "write an air traffic control system". At the fundamental level, they're all the same (except for the size of the problem).

First you figure out "what" you want.
Then you figure out "how" you're going to do it (in several iterations usually, getting more detailed each time).
Then you can start writing some code.

Once you've actually figured out the "how to program" step, then the problem and implementation are details.

Think "learning to drive". You only do this once.
Then "go fast, drive Ferrari" is one problem and implementation
and "move stuff, drive van" is another.
Sure there are a few details, and a bit of practice, but the basics should be there for either (or other) case.

Salem 5,265 Posting Sage

> I should change it to the month it was created instead.
Is it "January"?

Nick Evan commented: Haha +0
Salem 5,265 Posting Sage

List of things wrong with kaveyarrasan.k's effort:
- it's two years too late
- it's in C, not C++ (see the forum title)
- it has no code tags
- it uses void main
- it has a buffer overflow (<=25 steps off the end)
- the for loop to "search" for the char to replace serves no purpose. Just use a[n] directly.
- as the input buffer is un-flushed, the %c scanf will read the \n left behind by the %d scanf earlier.

Salem 5,265 Posting Sage

Well the Wiki link has at least one code example.
And I bet at least one of the couple of dozen links on the same page also have code as well.

Frankly, I don't think you've got the nouse to finish this assignment.
I'm finding it hard to believe you read the Wiki. More like you had a quick glance at it, then dismissed it as "useless" and posted your begging letter again.

It's your homework, make some more effort!
I'm not going to do it for you.

jonsca commented: Hopefully you meant the first definition ;) +2
Salem 5,265 Posting Sage

> please can u giv me the algorithm for the library management

int numBooksRead  = 0;
for ( i = 0 ; i < numShelves ; i++ ) {
  while ( numBooksRead == 0 );   // you are here (permanently)
}
tux4life commented: Nice one :P +6
Salem 5,265 Posting Sage

So what do you need us for?

Presumably there are some examples you can find (if you look hard enough), which you should study, then try for yourself.

Salem 5,265 Posting Sage

So start by doing some tests (or did you hope that you could write 500 lines and it would work first time).

Eg.

int main ( ) {
  printf( "Number of words in file=%d\n", words_in_file("test.txt") );
  return 0;
}

Keep testing that ONE function until it returns a good result for all your tests,

Then move on to the next function (which doesn't depend on other functions), say your comparisons.

Build up the picture of what works and what doesn't.

kvprajapati commented: Helpful suggestion. +6
Salem 5,265 Posting Sage

> I am attempting to write my first c++ program.
Mmm'kay.

> It is a bot that will me used to connect to a Multi User Dungeon.
Not likely.

> Do i need 2 seperate threads to do this?
Are you just throwing terminology around to impress us?

IMO, you need to put this idea on hold for 6 month and set about learning C++ from the beginning.

Sure, you might get there yourself, but every other day you'll be in some kind of hole, and on a message board asking for help on the latest problem you're faced with.
It might eventually get written, but it won't have anything to do with your skill as a programmer.

Salem 5,265 Posting Sage

http://en.wikipedia.org/wiki/ID3
They're not all-text.
They're not always at the beginning,
They're not always present.
They're not always ASCII.

You can't just open the file and read a string, and hope it all works.

Salem 5,265 Posting Sage

http://www.telegraph.co.uk/technology/news/6995354/Sarcasm-punctuation-mark-aims-to-put-an-end-to-email-confusion.html

The symbol – a dot inside a single spiral line – can be installed onto any PC running Windows 7, XP or Vista, as well as Macs and Blackberry mobile devices.

It can then be used in Word documents, instant messenger conversations, Outlook email and other programmes, just by pressing Ctrl and the full stop button.

Presumably the recipient of the sarcasm has to also fork out $1.99 to actually see it?
Otherwise what - some random "unknown" glyph or the raw unicode presents itself.

So rather than your recipient think you're being sarcastic, they instead think you're an idiot who can't use a keyboard.

Real smooth....

Salem 5,265 Posting Sage

http://www.psc.edu/general/software/packages/ieee/ieee.php
You subtract the offset from the exponent. A stored exponent of 128 say would map to a real exponent of 1. So fractions ultimately end up with negative real exponents (0.5 = 1 * 2^-1)

If you're able to extract the sign, exponent and mantissa bits, then the rest should be pretty easy. There is nothing irregular about fractions except for the magnitude of the exponent.

Salem 5,265 Posting Sage

http://lmgtfy.com/?q=please+tell+me+the+difference+between+a+condition+variable+and+a+semaphore
We're not your personal search engine interface!
If you continue to treat us as such, you'll just get ignored, or mocked.

Salem 5,265 Posting Sage

Well you do seem to be working your way through some exercise book...
http://www.daniweb.com/forums/thread252650.html
http://www.daniweb.com/forums/thread252933.html
http://www.daniweb.com/forums/thread252939.html

You're sorely lacking to pay attention to this.
http://www.daniweb.com/forums/announcement14-2.html

Keep it up, and you're going to get increasingly terse and abrupt meta-answers for appearing to be a sponge.