DeanMSands3 69 Junior Poster

Shsh111 stop asking for people to do the work for you and show us what you have done so far so we can help you. If you get people to do your homework for you your going to struggle when the time comes to do the work yourself which means you're going to have wasted a lot of your own time.

Nah, let's be fair. I think he's got upper-management potential.

DeanMSands3 69 Junior Poster

He once stopped looters from vandalizing a shop in London - while vacationing in Singapore.

DeanMSands3 69 Junior Poster

From the above-mentioned link (3rd sentence):

With the aid of this project, two or more persons can shat in an Intranet with one another.

AT. LONG. LAST.

OK, back on topic. After a bit of Googling, I found this:
http://sourceforge.net/projects/fmj/
Stale as of 2007, but that's whole lot better than JMF.

DeanMSands3 69 Junior Poster

This same question has been cross-posted multiple times:

http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/0ba199e9-e806-48bd-9b85-6f8668c732d4

http://stackoverflow.com/questions/11717613/how-can-i-get-a-dte-object-with-msbuild

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/120c6cdf-5bba-4396-8ac8-7fe507ae879a

The answer: DTE and serviceProvider are Visual Studio constructs. You're not going to get them in MSBuild. Ask your team leader if he wants any headlight fluid or ID 10-T forms while you're out.

DeanMSands3 69 Junior Poster

As an additional plug for Java (though my heart belongs to C++), you can write wrappers around native libraries to give Java access to them.

For example, the popular game Minecraft is written in Java, but includes hardware-accelerated OpenGL libraries which are only available natively. Wrappers were written for the OpenGL libs so that Java programs could use them.

DeanMSands3 69 Junior Poster

Are you using this on your PC or an XBox 360?
Look into XInput:
http://msdn.microsoft.com/en-us/library/hh405053(v=vs.85)

Here's a useful tutorial to get started (not quite what you were looking for, but it's the right direction.)
http://www.codeproject.com/Articles/26949/Xbox-360-Controller-Input-in-C-with-XInput

DeanMSands3 69 Junior Poster

If you include the fonts in any form, you need to give credit where credit is due. Bundle the license in a text file or make it somehow easily accesible to the user like in a "Credit and Thanks to" page included in the game.

DeanMSands3 69 Junior Poster

Here's a listing of some free and partial ebooks on Game Programming.
http://www.e-booksdirectory.com/listing.php?category=264

Happy coding.

DeanMSands3 69 Junior Poster

Techy23: You're still using Turbo C. Do yourself a big big favor.

Drop Turbo C. Like it's on fire. Covered with ants. Ants on fire.

Get a copy of Orwell Dev C++. http://sourceforge.net/projects/orwelldevcpp/
Then add SDL to the MinGW compiler that comes with it. http://www.libsdl.org
Then you'll want to add the SDLMixer project to play cool music. And SDLImage to add cool graphics.
Grab them here:
http://sourceforge.net/projects/libsdl/files/

PM me when you've done all that, and I'll send you some code to play with.

DeanMSands3 69 Junior Poster

AD's already got this one covered, but I wanted to throw something in as well.
If you want a static function to use instance specific data, you have to pass a pointer to the instance as a parameter:

You modify your FClass::PrintIt like so:

static void PrintIt(FClass *instance)
{
    printf("%d",instance->number); // Print the number
}

And your fPointer definition to be:

void (*fPointer)(FClass *); // This will point to a function in FClass

And your assignment becomes:

fPointer=FClass::PrintIt; // Give the pointer the function address

To be used like this:

fPointer(&instance);

I learned this when I was combining classes with threading for the first time. (I'm still quite the noob at parallel programming).

Ancient Dragon commented: good points :) +14
DeanMSands3 69 Junior Poster

Let's see... I'm going to troll a bit here. From the name Shankar, I'm guessing he's Indian. With that, I'm going to assume that he's using our beloved Turbo C++ in 16 glorious bits. I'm going to further guess that there's an overflow error lurking about here somewhere.

np complete commented: lol :P +0
DeanMSands3 69 Junior Poster

There are multiple problems. I've got time for only a few.
In your insert_front() function you have this:

   if(n==NULL)
   {
    cout<<"\nOverflow\n";
    getch();
   }

It should have a return; statement inside it.

   if(n>=5)
    {
     delete_end();    
    }

This needs to be fixed. Here, you're trying to count the number of items. But n doesn't contain that. n is a pointer - a numerical address in memory. I'm more than certain that it will be getting a value bigger than 5. What you actually want to do is to insert the node (move the code out of the else block in front of the if; you don't need the else). Create an integer. Set it to 1. Move from node to node counting until you reach the end. If the number is bigger than 5, delete that node, decrement the number, and walk back. Keep doing until you have at most 5 blocks.

DeanMSands3 69 Junior Poster

I'm going to throw my hat in support of AD on this one.
On Bush and Iraq:
After 9/11, everyone was angry. Democrats, Republicans, Independents, everyone. We went into Afghanistan and Iraq to clean house. And we did. We thought it would be a quick "kill the bad guys, and save the day" war. Everyone did. It was only after things started to drag out that people started to complain and we started to wonder if going into Iraq was such a good idea.

(For a clarification of the usage of "everyone", I'm going to define that as "an over-whelming majority").

On the subject of guns:
Sure, they're a nuisnace while you have them, but you'll miss them when their gone.
Krystalnacht.
Nanking Massacre.
Stalin's USSR.
Early Communist China.
KKK.

On the subject of what kills who in the US:
Deaths_in_2009

Want to save lives? Outlaw the double cheeseburger.

DeanMSands3 69 Junior Poster

If your using Turbo C, you're pretty much stuck in DOS. But you can run programs inside that magical wonder called DOSBox.

I recommend learning graphics using the old Denthor VGA trainers as translated into C by Chris Mann.
ftp://ftp.scene.org/mirrors/hornet/code/tutors/denthor/

Then, once you understand all that, then you're ready for the good stuff.
Get an Orwell Dev-C++ install and download libSDL. You'll love it.
(Orwell Dev-C++ and libSDL are both easily googled.)

DeanMSands3 69 Junior Poster

Try Allegro 5 or SFML 1.6. (SFML2 is nearing completion.)

Program a bouncing ball.
Then, program a VERY SIMPLE Tetris clone.
After that, look into scripting languages.
Start simple. Read in a file that says something like:

show background.jpg
show hero.png
play music.mp3
print "Hero Game by Techy23!"

Go from there.

Also, hire yourself a music guy and an art guy.

Have fun!

DeanMSands3 69 Junior Poster

Yeah, what WaltP said. Edit: And Labdabeta.
Ouch. Ouch. Ouch. This code really hurt me. I kept thinking that a finite state machine version would be a better approach. Ask if you're interested.
Back to your code, I debugged far enough to get it sort of working. It took a lot longer than I'd have liked it to.

int s=i; should be int s=i-1;

                    if (isValidCharacter(emails[s]) == false)
                    {
                        s++;
                        if(isValidCharacter(emails[s]) == true) break;
                    }

should be

                    if (isValidCharacter(emails[s]) == false)
                    {
                        s++;
                        if(isValidCharacter(emails[s]) == true) break;
                        else if(s==i) break;
                    }

int e = i; should be int e = i+1;

if(e = emails.length()) break; should be if(e == emails.length()) break;

if(e == '.') should be if(emails[e] == '.')

There's a few other changes I made.

Here's a full listing of my code with lines added for debugging. It's not %100, but it's better than nothing.

#include <fstream>
#include <iostream>
#include <string>
using namespace std;

class toLower{public: char operator() (char c) const {return tolower(c) ;}};

bool isValidCharacter(char c)
{
    bool validCheck = false;
    if ((c>='A' && c<= 'Z') || (c>='a' && c<='z') || (c>='0' && c<='9') || (c=='.') || (c=='-') || (c=='+'))
    validCheck = true;
    return validCheck;
}

int main()
{
    ifstream fin;

    string inputFile;
    string outputFile;
    string defaultInput = "fileContainingEmails.txt";
    string defaultOutput = "copyPasteMyEmails.txt";

    cout << "Enter input filename[default: fileContainingEmails.txt]: ";
    getline(cin, inputFile);

    if (inputFile.length() == 0)
    {
        inputFile = defaultInput;
        outputFile = defaultOutput;
        cout << "Enter output filename[default: copyPasteMyEmails.txt]: …
DeanMSands3 69 Junior Poster
DeanMSands3 69 Junior Poster

Have you tried 3D matrix transforms?
http://www.fastgraph.com/makegames/3drotation/3dsrce.html

DeanMSands3 69 Junior Poster

I'm not entirely sure what you're trying to do, but I took a guess:

#include <iostream>
#include <iomanip>

using namespace std;
int main ()
{
    // variables
    double salary = 0.0;
    int RATE = .03; //Why is this an integer? Integers don't have decimals.

    // enter salary
    cout << "Salary (-1 to stop): ";
    cin >> salary;

    // display raises with 2 decimal places
    cout << fixed << setprecision(2);

    //begin loop 
    while (salary != -1)  
    {
        cout << "Annual Raises for next three years: " << endl;

        // while loop to calculate annual raises
        while (RATE < .07)
        {
            // display annual raise amount
            cout << RATE * 100 << "% raise: ";
            cout << salary * RATE << endl;

            // update salary value and annual raise rate.
            salary += (salary * RATE);
            RATE += .01;

            //enter salary  //Why?

            cout << "Salary (-1 to stop): "; //WHY????
            cin >> salary; //AAARRRRGGGGHHHH!!!!!

            // reset variables
            RATE = .03; //You've condemned us to loop here eternally!

        } //end of loop
        return 0;
    }   // end of file //No, it's not.
    }   // This is.

So I rewrote it to do what I GUESSED was what you wanted.
Disclaimer: No flamingos were harmed in the rewriting of this software.
Amended Disclaimer: Yet.

#include <iostream>
#include <iomanip>

using namespace std;
int main ()
{
    // variables
    double salary = 1.0; //Change so that
    double RATE = .03;


    // display raises with 2 decimal places
    cout << fixed << setprecision(2); …
DeanMSands3 69 Junior Poster

Don't worry about the lack of C++ in the MinGW include folder. It's not supposed to be there. There IS one in the \lib\include folder though. But that's irrelevant. Your code is designed to break anyway.

And all the C:\Dev-Cpp\Include and C:\Dev-Cpp\lib entries need to go. Find them in your Dev C++ settings, and delete them.

If you want to start over (AND I REALLY REALL RECOMMEND IT), let me suggest several options. (Take a long hard look at G.) All involve uninstalling your current Dev C++.

Step 0. Uninstall your current Dev-C++. Now.

A. Install Dev C++ without MinGW.
Go here: http://sourceforge.net/projects/dev-cpp/files/Binaries/Dev-C%2B%2B%204.9.9.2/
Grab the "No MinGW" setup.

B. Orwell DevC++ (updated and extended version of Dev C++)
Dev C++ was awesome in its day, but it's time to move on. If you still need to cling that old familiar face, go here: http://orwelldevcpp.blogspot.com/

C. wxDev-C++:
Same idea as Orwell, but with wxWidgets packaged in. (Orwell might have a better IDE though).
http://wxdsgn.sourceforge.net/

D. Code::Blocks
http://www.codeblocks.org/

E. NetBeans
Now we're playing with the big kids.
http://www.netbeans.org

F. Eclipse
(Only get this AFTER you've got the hang of NetBeans.)
http://www.eclipse.org

G. Qt
You. Want. This.
http://qt.nokia.com/downloads

DeanMSands3 69 Junior Poster

YOUR. CODE. IS. BROKEN.
Read the comments in the code.
It's designed to fail.
In my fully updated MinGW/MSYS install, I compiled it. Note the name I gave it.

dean@stormbringer /c/Workspace/C++/DaniWeb
$ g++ -std=c++11 FOR_73H_LULZ.CPP
FOR_73H_LULZ.CPP: In function 'int main()':
FOR_73H_LULZ.CPP:22:14: error: no match for 'operator==' in 'a == b'
FOR_73H_LULZ.CPP:22:14: note: candidates are:
FOR_73H_LULZ.CPP:22:14: note: operator==(main()::Fruit, main()::Fruit) <built-in>
FOR_73H_LULZ.CPP:22:14: note:   no known conversion for argument 1 from 'main()::Color' to 'main()::Fruit'
FOR_73H_LULZ.CPP:22:14: note: operator==(main()::Color, main()::Color) <built-in>
FOR_73H_LULZ.CPP:22:14: note:   no known conversion for argument 2 from 'main()::Fruit' to 'main()::Color'
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/iosfwd:42:0,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ios:39,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ostream:40,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/iostream:40,
                 from FOR_73H_LULZ.CPP:1:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/postypes.h:218:5: note: template<class _StateT> bool std::operator==(const std::fpos<_StateT>&, const std::fpos<_StateT>&)
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/postypes.h:218:5: note:   template argument deduction/substitution failed:
FOR_73H_LULZ.CPP:22:14: note:   mismatched types 'const std::fpos<_StateT>' and 'main()::Color'
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_algobase.h:65:0,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/char_traits.h:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ios:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ostream:40,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/iostream:40,
                 from FOR_73H_LULZ.CPP:1:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_pair.h:212:5: note: template<class _T1, class _T2> constexpr bool std::operator==(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_pair.h:212:5: note:   template argument deduction/substitution failed:
FOR_73H_LULZ.CPP:22:14: note:   mismatched types 'const std::pair<_T1, _T2>' and 'main()::Color'
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_algobase.h:68:0,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/char_traits.h:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ios:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ostream:40,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/iostream:40,
                 from FOR_73H_LULZ.CPP:1:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_iterator.h:293:5: note: template<class _Iterator> bool std::operator==(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_iterator.h:293:5: note:   template argument deduction/substitution failed:
FOR_73H_LULZ.CPP:22:14: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'main()::Color'
In file included from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_algobase.h:68:0,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/char_traits.h:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ios:41,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/ostream:40,
                 from c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/iostream:40,
                 from FOR_73H_LULZ.CPP:1:
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_iterator.h:343:5: note: template<class _IteratorL, class _IteratorR> bool std::operator==(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&)
c:\qtsdk\mingw\bin\../lib/gcc/mingw32/4.7.0/include/c++/bits/stl_iterator.h:343:5: note:   template argument deduction/substitution failed:
FOR_73H_LULZ.CPP:22:14: note:   mismatched types 'const std::reverse_iterator<_IteratorL>' and 'main()::Color' …
DeanMSands3 69 Junior Poster

Madness?

THIS IS DANIWEB!!

Here are a few guides to help you out.
http://www.cs.virginia.edu/~evans/cs216/guides/x86.html - Look at the table on the first page. Then jump to the next link. Jump back when the register functions make sense.
http://www.eecg.toronto.edu/~amza/www.mindsec.com/files/x86regs.html - This gives an overview of which registers do what.

DeanMSands3 69 Junior Poster

Just finished an orange. It was delicious.

DeanMSands3 69 Junior Poster

@Critical Error: From the frontpage, "Our Geeks' Lounge forum is the place to chat about anything. Have fun and relax in this forum."
Technically, I could start topic about rutabagas and asparagus. I'd get down-voted for it, but I could still do it.
@Hani1991: Carry on, sir. Carry on.

DeanMSands3 69 Junior Poster

Ref: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681944(v=vs.85).aspx
Are you running in a seperate process?
Are you familiar with multiple processes?
Are you familiar with Interprocess communication? (It's really really fun!)

A Windows process can only be tied to one console at a time. So... create a new process. From that process, call FreeConsole. The console WON'T be destroyed. Then call AllocConsole.

I haven't researched too deeply, but if you want some backup I'll be happy to help.

triumphost commented: Helpful! +5
DeanMSands3 69 Junior Poster

The specification is hosted by libPNG here: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html

Read the specification and figure out how to write a decoder.
If you've never worked with compression algorithms before like LZW and LZMA, it's probably a good idea to start now.

Actually, actually...
forget all that.
Start with a GIF decoder. Learn the ins and outs of image compression. THEN try tackling something as nuts as PNG.
http://www.w3.org/Graphics/GIF/spec-gif89a.txt

Edit: I've never actually written one, so if you're up for the challenge, I'll be happy to work with you on it.

DeanMSands3 69 Junior Poster

Here's a hands on example.

(A good reference to look at first:) http://stackoverflow.com/questions/1395591/what-is-exactly-the-base-pointer-and-stack-pointer-to-what-do-they-point

I modified the C code a little:

int foo=1;
int main(int argumentCount, char *arguments[])
{
    const char* bar = "Hello, Daniweb!";
    char *firstArg;
    int num;
    num=1;
    num=argumentCount;
    num=0;
    firstArg=arguments[1];
    firstArg=(char *)0;

    return num;   
}

I compiled using MinGW: gcc -S blah.c
This is a 32-bit system. YMMV.
Assembly:

    .file   "blah.c"
    .globl  _foo
    .data
    .align 4
_foo:
    .long   1
    .def    ___main;    .scl    2;  .type   32; .endef
    .section .rdata,"dr"
LC0:
    .ascii "Hello, Daniweb!\0"
    .text
    .globl  _main
    .def    _main;  .scl    2;  .type   32; .endef
_main:
LFB0:
    .cfi_startproc
    pushl   %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    andl    $-16, %esp
    subl    $16, %esp
    call    ___main
    movl    $LC0, 12(%esp)
    movl    $1, 8(%esp)
    movl    8(%ebp), %eax
    movl    %eax, 8(%esp)
    movl    $0, 8(%esp)
    movl    12(%ebp), %eax
    movl    4(%eax), %eax
    movl    %eax, 4(%esp)
    movl    $0, 4(%esp)
    movl    8(%esp), %eax
    leave
    .cfi_restore 5
    .cfi_def_cfa 4, 4
    ret
    .cfi_endproc
LFE0:

As you can see, the "Hello" text is in the .data segment and not the .text segment where the code is.

Now let's look at what this actually does:
(The .cfi commands are pre-assembler directives and can be ignored for our purposes.)
EBP is the frame pointer.
It gets saved with pushl %ebp
ESP is the stack pointer.
At first they are set equal to each other by movl %esp, %ebp
It looks like ESP is being byte-aligned to 16 …

DeanMSands3 69 Junior Poster

When life's got you down, just remember: You could be fixing someone else's poorly-written code in a language you barely understand.
And if you are, well, you have my sympathy.

DeanMSands3 69 Junior Poster

I'm going to go out on a limb and say the OP is asking for help in adding the ability to save data to and recall data from a file.
Also, it seems the OP copy and pasted the code 7 times.
To the OP's credit, the code was posted properly which is not always common for first-time posters.

DeanMSands3 69 Junior Poster

Dead thread is dead. Leave dead thread dead.

On the subject of how to go about doing this there's a few different ways:
A. Use pipes.
B. Use sockets.
C. Use environment variables.
D. Use shared memory.

Also, the OP didn't realize the word would be passed as a parameter on the command-line instead of reading in with a prompt.
Admittedly, this is one of the few times where I've read an entire first post instead of skimming it. (I've gotten in trouble for that.)

DeanMSands3 69 Junior Poster

Duly noted. I'm just showing that allocation and initialization can be two seperate steps.
Last code segment from me for this post:

#include <cstdlib>
#include <iostream>
using namespace std;
class C{
public:
    C(){
        cout<<"C's constructor called."<<endl;
    }
    virtual ~C(){
        cout<<"C's destructor called."<<endl;
    }
    virtual void virtualFunction(void)=0;
};

class A:public C{
private:
    int i;
    int j;
public:
    A(){
        cout<<"A's constructor being called!"<<endl;
    }
    ~A(){
        cout<<"A's destructor being called!"<<endl;
    }
    void virtualFunction(void){
        cout<<"A's virtual function!"<<endl;
    }
    int getI(){return i;}
    void setI(int newI){i=newI;}
    int getJ(){return j;}
    void setJ(int newJ){j=newJ;}
    void doesThisWork(){
        cout<<this->i<<"\t"<<this->j<<endl;
    }
};

int main(){
    cout<<"Setting up 'e' object."<<endl;
    C *e=(C*)malloc(sizeof(A)); //Allocate
    new (e) A(); //Call constructor
    ((A*)e)->setI(9);
    ((A*)e)->setJ(18);
    e->virtualFunction();
    cout<<((A*)e)->getI()<<"\t"<<((A*)e)->getJ()<<endl;
    ((A*)e)->doesThisWork();
    ((A*)e)->~A();  //Call destructor
    free(e);    //De-allocate
    cout<<"Done with 'e' object."<<endl;
    return 0;
}

That is some really ugly code. I feel ashamed of myself now.

DeanMSands3 69 Junior Poster

"Without vision, the people perish, and Lo! and Behold! we have received exactly that: a vision of the people perishing." -Dave H.

DeanMSands3 69 Junior Poster

SFML has multiple interfaces including one that is C-only (CSFML).
http://www.sfml-dev.org/

DeanMSands3 69 Junior Poster

Solved question is solved. But I'm going to throw this in here anyway.

#include <cstdlib>
#include <iostream>
using namespace std;
class A{
private:
    int i;
    int j;
public:
    A(){
        cout<<"Constructor being called!"<<endl;
    }
    ~A(){
        cout<<"Destructor being called!"<<endl;
    }
    int getI(){return i;}
    void setI(int newI){i=newI;}
    int getJ(){return j;}
    void setJ(int newJ){j=newJ;}
    void doesThisWork(){
        cout<<this->i<<"\t"<<this->j<<endl;
    }
};

int main(){
    cout<<"Setting up 'a' object."<<endl;
    A *a=(A*)malloc(sizeof(A)); //Allocate
    new (a) A();    //Call constructor
    a->setI(10);
    a->setJ(20);
    cout<<a->getI()<<"\t"<<a->getJ()<<endl;
    a->doesThisWork();
    a->~A();    //Call destructor
    free(a);    //De-allocate
    cout<<"Done with 'a' object."<<endl;

    cout<<"Setting up 'b' object."<<endl;
    A *b=(A*)malloc(sizeof(A)); //Allocate
    b->setI(9);
    b->setJ(18);
    cout<<b->getI()<<"\t"<<b->getJ()<<endl;
    b->doesThisWork();
    free(b);    //De-allocate
    cout<<"Done with 'b' object."<<endl;
    return 0;
}

Your mileage may vary. On mine (MinGW 32-bit on Windows XP), it worked fine.

Got a little help from here on using new AFTER the class is allocated:
http://stackoverflow.com/questions/2995099/malloc-and-constructors

DeanMSands3 69 Junior Poster

Well, Code::Blocks, like Dev-C++ is an IDE that (usually) comes packaged with the MinGW compiler (based on GCC). If you're still willing to give it another serious try, do this:

First install the MinGW GCC compiler and the MSYS compiling environment (not an IDE).
Go to: http://sourceforge.net/projects/mingw/files/
A little above the middle of the page, there wil be a link that says: Looking for the latest version? Download mingw-get-inst-xxxxxxxx.exe (xxxKb)
Get it.
Run it.
Go fo the latest repository.
Choose (at least) the C and C++ compiler options and also the MinGW Developer Toolkit with the MSYS base system.

I'm going to leave it at that for now, but I'm omitting some really awesome stuff. I'll write a full post on how to set up a super-nice setup. It just requires a LOT of work.

Tell Code::Blocks where to find MinGW and you'll be in business.

DeanMSands3 69 Junior Poster

@Samyx: Try using a dictionary/look-up table approach. Create a table where you plug in the first two spots (0 and 1). Then have your program plug in the data if it isn't already assigned. You might want to fill the table with -1's at first, then assign the first two spots. If a table location holds a -1, your program will know that spot hasn't been assigned yet and needs to be calculated.

@IntermediateTech: You have to compile in the Posix Threads library. If you're using GCC, you'll want to use the -lpthread option.

EDIT: I suddenly realized this was a necro-thread. /facepalm

DeanMSands3 69 Junior Poster
DeanMSands3 69 Junior Poster

I never thought I'd see Google advertising Prostate Cancer Treatment on Daniweb.
Well done, codeorder. Well done.

codeorder commented: .no.sh.t?(lmaooo and running away "with" the keyboard:) +0
DeanMSands3 69 Junior Poster

A C++ programmer contemplates Microsoft Excel VBA:

"Where the Hell am I and why the Hell is everyone here completely stoned?"

DeanMSands3 69 Junior Poster

Welcome to DaniWeb! We're glad to have you join us!

DeanMSands3 69 Junior Poster

Whenever I start a new programming languange, I always like to start with the same basic program: A podcast ripper.
A podcast ripper is a very simple program, but it gives you insights into different aspects of the programming language, the API, and the platform.

  1. You download a podcast listing.
  2. You parse out the xml.
  3. You identify the individual podcast nodes.
  4. You find the media file inside the podcast XML node.
  5. You download the media file.
  6. You move on to the next podcast XML node.

Furthermore, you can take the different versions of the same program from different programming languages and compare the two. That's probably the best part. It's a very healthy exercise for your brain.

Now, go do it in Python, then Java, then C#/Mono, then C++ for your particular OS/platform.

Happy coding!

DeanMSands3 69 Junior Poster

Here're some others:
First, get a copy of Oracle VirtualBox to run the new OS inside of.
https://www.virtualbox.org

MikeOS is a good place to get started:
http://mikeos.berlios.de/
A related video is here: (Pay attention at 1:57 when he says this takes effort)
http://www.youtube.com/watch?v=6MJUGVFAXKg

These are a series of articles:
http://linuxgazette.net/issue77/krishnakumar.html
http://linuxgazette.net/issue79/krishnakumar.html
http://linuxgazette.net/issue82/raghu.html

Miscellaneous articles:

http://himmele.blogspot.com/2011/07/build-your-own-operating-system.html

http://www.acm.uiuc.edu/sigops/roll_your_own/

http://www.wikihow.com/Make-a-Computer-Operating-System

http://www.codeproject.com/Articles/15843/Building-your-own-operating-system

And Holy Crap! That OSDev is good stuff! I can't believe I've never seen that before. (Never gave serious consideration to writing an OS, but after seeing that, I just might...) Props, asrockw7.

DeanMSands3 69 Junior Poster

Here's a hint:
Line 114:bool IsInt32(string s) {
Should look like: bool Convert::IsInt32(string s) {

This is not the only change you will have to make.

Later on, I suggest you change the methods in your Convert class into static's so you can call them directly from the class instead of creating a Convert object everytime. But save that for later. For now, this will probably only be confusing. Right now, just get it working. Then, get it working nicely.

DeanMSands3 69 Junior Poster

"I HAVE THE POWER !"

He-Man

If I owned this place and Hell, I'd rent this place out and live in Hell. - Toombs

Chronicles of Riddick

However! This quote could possibly be a nod to a famous quote by J. Golden Kimball:

"I don't know how the people of St. George can stand the heat, the Indians, the snakes and the flooding Virgin River. If I had a house in St. George and a house in Hell, I'd rent out the one in St. George and move straight to Hell."

Here's a quote from a movie I enjoyed.

Slap some bacon on a biscuit and let's go! We're burnin' daylight!

DeanMSands3 69 Junior Poster

Sufficient to the day is the evil thereof - unless you're an embedded systems developer.

DeanMSands3 69 Junior Poster

tl;dr: MegaMan's storyline sucks. I want advice in writing it as realistically as possible.

I want to dip my toes into the realm of fiction (due to much prodding by my wife). I decided I wanted to start with a fan-fiction project based on the popular game MegaMan (also thanks to my wife). Regrettably, the canon story-line is too far-fetched to be plausible (especially for the time they specify). The fanon (fan writing) is worse.

I want to write a fan story to set a new standard.

I want to write a story where:

  • Actual human emotions and relationships are twisted and warped as they struggle with their new start-up.
  • Dr. Wily stays up to 5 in the morning swearing at his soldering iron.
  • Dr. Light bullies grad students to get his name on their papers.
  • They both have to learn Power Point to build proposals. It completely baffles them.
  • Dr. Light has read I, Robot cover to cover 15 times.
  • Dr. Wily got through 2 readings, but really likes the movie better.
  • They both work odd contract jobs to build capital and desperately grasp for funding, once or twice losing large sums to phony investors.
  • Dr. Wily has to hack a Kinect to work with OpenCV to get an initial vision prototype going.
  • Dr. Light spends countless sleepless hours working on stubborn neural networks.
  • Pair programming works. Until it doesn't.
  • Politics, controversy, and the constant threat of looming war hang over them.
  • Company politics are just as …
DeanMSands3 69 Junior Poster

70415567
Next Word: Python

DeanMSands3 69 Junior Poster

14905311

Next Phrase: Pair Programming

DeanMSands3 69 Junior Poster

First, learn to use Allegro. Start here: http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial
Start with this one: http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial#Installing_Tutorials
Get your Allegro libraries setup in your compiler. Then get them ready to link into your project. (Many times, you will need to tell it to link in both Debug and Release configurations).

Now check out the code tutorials:
http://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials

Once you get that, copy and paste the code. Try it and compile.
If it doesn't work and you're using image files, there's a good chance you need to copy the data files into the same folder as where the program is executing from.

Once you get Allegro done, let us know and we'll help you get CXImage working in it. For now, focus on Allegro.

Good luck and happy coding!

DeanMSands3 69 Junior Poster

The daisies in my garden asked me that just the other day. I felt they were asking too many questions and had my cat "teach them a lesson."
What is the nutritional value of Green Eggs and Ham?