Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

[sarcasm]
WASHINGTON—President Barack Obama held a nationally televised address Tuesday to "clarify any misunderstandings" about his health care proposal, assuring Americans that under the new bill senior citizens—and not the federal government—will have the right to choose how they are executed.

"Let me dispel these ridiculous rumors once and for all and set the record straight: Under my plan, seniors are going to be killed the way they want to be killed, end of story," said the president, who acknowledged that "wiping out" the nation's elderly population has always been his No. 1 priority. "If your grandmother would rather be euthanized in the privacy of her own home than be gutted and hanged on a high school soccer field, she is entitled to that right.
[/sarcasm]

Read the rest of it here.

Ezzaral commented: hehe, thanks :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I wouldn't pay much attention to that article -- pirated copies are probably very buggy. I will wait until I get my hands on the real thing before making any pronouncements one way or the other.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Technology and lack of physical exercise are the biggest contributors to why Americans are so fat. Just watch Biggest Loser and you will see men and women who weight 400+ lbs! Americans are so fat because they sit on their ass so much watching tv or playing on their computers. Kids today would rather sit by themselves for hours playing video games instead of outside socializing with other kids their own ages. And that makes them social misfits when they grow up.

Vineeth K commented: I think you are right +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm curious. You seem so sure, but you don't say why, and your assurance is totally at variance with my own experience. In fact I'll state straight out that Linux is easier to use than Windows.

I tried two different distributions of *nix (Fedora 11 and Ubuntu) over a whole week and neither of them worked the way I wanted them to. I have a 64-bit computer with 5 gig ram and 750 gig hd, I could not get the sound to work right nor would it play movies on dvd drive.

Eveything worked straight away when I installed Microsoft Vista Home Premium. There were no additional packages to install nor did I have to tweek the os to make it work with my computer.

I still have my computer dual booting with Fedora 11, but I have Vista set as the default os. The only time I boot into Fedora now is so that I can test compile some programs on *nix. Otherwise I won't bother with all the hassle.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ok, now I'm getting 2 errors. Do you see whats wrong?

This is your lucky day -- I meant to give you negative rep for not using code tags but instead gave you positive rep :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1. That program is not using a "random access file". Those kinds of files are binary files with fixed-length records. What you are doing is sequential access file -- reading from beginning to end in an attempt to find a given record, and the records may or may not be fixed-length.

2. Your program would be easier to read and comprehend if you used functions to replace all that code in the switch statement.

3. What is the question? You posted a lot of code without telling us what your problem is.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You don't because that compiler is too old.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Start here to learn how to write a compiler. If you can not do that simple task then writing a compiler is not for you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Multiple lines of code within if statements must be enclosed in brackets { and }

if( condition )
{
    // do this
    // do that
}
else
{
    // do something else
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

read this article. You need to download the Windows DDK.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

many floating point values can not be represented exactly in memory due to the way they are stored. For a complete explanation read this wiki article which will probably tell you a lot more than you dared to know.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

aahahaha!

im not really in on reading rules

Than I can't be bothered to help you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What's the problem? just replace that static text with a wchar_t* variable

TCHAR buf[] = L"lars";

hWnd = CreateWindow( L"3ngine",  buf,
                              WS_OVERLAPPEDWINDOW, xPos, yPos, xSize, ySize,
							  NULL, NULL, wc.hInstance, NULL );
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>The problem is that i cant select which one.
Whether Visual C or JAVA or python ..

"Visual C" is not a language -- its just the name of a compiler. You can use it to compile both C and C++ programs.

Why do you have to choose just one of those languages. Learn them all. If you have a good basic understanding of C language then learning Java and phython should be a snap because they all have a lot of things in common that you already know. But don't be like the "jack of all trades" ... know a little bit of everything but a master of none.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

and quit assuming everyone on here is a "sir". sexist language was deprecated last century. get with the program.

It might be a cultural thing. I recall when ~S.O.S~ first joined DaniWeb he used to be very formal and called every Mr. XXX. It took some doing but we finally broke him of that habit :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

unions are used whenever the same data can be represented in two or more ways, or by two or more data types. Normally I think unions are place inside structures, something like a VARIANT structure. This structure has two members, an integer that tells which of the union members are used, and then the union of 20 or so data types.

>>.Also why are unions specifically used in mouse programming
AFAIK unions are not used for that purpose because the program needs to know both the x and y coordinates of the mouse. A union would not provide that information.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I'm not happy that my rep power went to only +5.
Ohhh. I see mine went from 60 to 24, and negative from -30 to -12. I'm happy about the negative rep because afterall that's what I asked for in the other thread I started here. I can live with 24 positive rep too because I thought 60 was a bit excessive too.

>>i think the most grievous offender is the row of "share this" "send that" "bookmark" "yadda yadda" buttons.
Agree. I don't know what those buttons do and don't want to press one so that I can find out. I'm on twitter, but I don't know what the twitter button will do.
[edit]Oh! Well I just clicked it and found out what it does. Not sure how useful it is except in places such as blogs.[/edit]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CString class is actually not belong the MFC class library. It is in ATL. You can use appropriate ATL headers to use CString in any Windows C++ application.
For more information on how you can use CString in a C++ project, read thease articles.
string classes

How to use CString

I think Microsoft has changed CString since VC++ 6.0, where it was part of MFC. In VC++ 2005 and later compilers you reminded me that they changed it to be part of ATL, as they did many other MFC classes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

...in the above blurb of code (post #3 in this thread), if <string> is replaced with <string.h>, the whole thing flies apart! If its not asking too much, I'd love an explanation of that one.

<string.h> is from C language and contains prototypes for C's standard string handling functions for character arrays, such as strcmp(), strcpy(), etc. It can be used in either C or C++ programs. When used in c++ programs <string.h> is normally renamed <cstring>. The only difference between the two is that <cstring> puts all those functions in std namespace while <string.h> the functions are in global namespace.

<string> is c++ only and contains the standard STL (standard template library) string class. It's completly independent of anything that is in string.h. Both <string> and <cstring> can be used in the same c++ program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One problem with your program is that the value of MAX may or may not be big enough. If I enter the value 10 then MAX is too large because 10 in binary is only 4 digits (1010). But if I enter the value of 123456 the binary value is 11110001001000000, which is clearly larger than 8 digits.

Instead of using an array of ints to hold the 1's and 0's just put them in a large character array, then keep track of the number of digits actually used in an integer.

So the calculation in the first loop you posted stops when the value of num is 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think it could be done pretty simply like this:

template <class elemType>
void arrayListType<elemType>::removeDups(const elemType& removeItem)
{
	int loc;
    for( loc = 0; loc < length-1; loc++)
    {
        if( list[loc] == removeItem)
        {
            removeAt(loc);
            --loc; // repeat last test because item has moved
       }
   }
} //end remove
LaurenR commented: Thanks so much for the help! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I wish I had a programming class in high school.

So do I -- but they didn't offer it in 1958 :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can you put a time limit on voting, such as when a time expires then no more votes are possible? Six months seems a reasonable limit. I have seen some of my very very old posts (2-4 years) with votes. The same for applying rep should also apply.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Every program must have one main() function. The code you posted does not have that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Stop flooding DaniWeb with that same question. Read the responses you have received in your original thread.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What exactly do you mean by "it is not working"? Do you take your broken car to the auto repair shop and tell them that "it is broken -- please fix it"? (trying to get you to learn how to fix your own problems). Start out by learning how to use your compiler's debugger.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 18 has two parameters, line 26 only has one.

Never put the function implementation code into a header file because the linker will report duplicate declaration errors.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

thanks. I asked teacher he told me same thing.

Guess you thought we didn't know what we were talking about :icon_eek:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Next time use code tags when posting code. That [code] link isn't just to make DaniWeb pretty.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think you mean nested menus.

void menu2()
{
    // do some menu stuff
}

void menu1()
{
   // display a menu

   switch (selection)
   {
           case 1: menu2(); break;
           // other choices follow
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to use pointers to pointers (double stars)

const int dataSize1 = 5;
const int dataSize2 = 6;

void LoadData(char** file, float** data1, float** data2)
{
       // read data size and contents from file
       *file = new char[255];
       strcpy(*file, "This is a test");
      *data1 = new float[dataSize1];
      *data2 = new float[dataSize2];
      // store data
      (*data1)[0] = 1.0f;
      (*data2)[0] = 2.0f;
      // etc ...
}
int main()
{
    char *f1 = 0;
    float *f2 = 0, *f3 = 0;
    LoadData(&f1, &f2, &f3);
    cout << f1 << " " << f2[0] << " " << f3[0] << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I am not sure if i am doing it right, of if i am just way off. Can someone help me?

Didn't you run the program? If not, why not ? Don't ask us if your program will work or not -- you can find that out by yourself by simply running it on your computer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Actually, the program is for linux/x86.

I would think the same would work by using shared libraries.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry cscgal, saw the up/downs were grey and assumed they were disabled. Why are they greyed out?

Probably because people were complaining about them being in color. But if you click up or down array the arrow will change color.

In another post Dani said we would be able to change our vote, but I have not seen that ability yet.

[edit]Oops! yes that does work afterall, I was able to toggle from 1 to -1, but not from 1 to 0. I guess that makes sense because 0 represents no vote.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh nevermind, my own fault :@

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And use code tags -- see that link that says [code] ? That wasn't put there just for decorations.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what's an IM client?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could do it with function pointers or even entire DLLs. If the program is large then I'd put the interfaces into different dlls so that it can be loaded then the main application program starts up, by calling win32 api function LoadLibrary() -- assuming this is a MS-Windows program.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hey plz add .Net and Visual basic 6

Those are not computer languages. .NET is part of the Windows operating system, and VB6 is a compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to use code tags.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The console is a shared resource among all threads. It would be just a jumbled mess if one thread tried to output text to the console screen at the same time you are trying to input text with fgets(). I would think you need to redesign the threads so that confusion doesn't happen.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to completly rewrite the file, omitting the string you want deleted.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>while(strcmp(&cmd, "end") != 0)

cmd is declared as a single character, therefore the above line, as well as all other similar lines, are just horseshit. A single character can not contain a string, and any attempt to pass a pointer to a single character to any string handling function such as strcmp() will fail.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you might want to call the >> operator in the while loop instead of get_account_number() so that the program can get the input data

while( cin >> b )
{
     if( b.get_account_number() == -1)
     {
              break;
     }
     // blabla

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you naming of the file is confusing. infile is usually referencing a istream object. ostream objects are normally named outfile.

line 26: all that does is return the account number. There is nothing in that loop that will change the account number, thus its an infinite loop. line 38 calls the overloaded << operator, and it doesn't change the value of b either. So I have no idea from what you have posted how the values in b ever get changed. I assume the program should be calling the >> operator with an ifstream object somewhere. But that's never called in your program either.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My guess is that line should be calling the overloaded >> operator while( infile >> b ) , but its only a guess because I don't know what your program is supposed to be doing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Basically the please hit any key to enter doesn't show up in Visual C++.Thanks for help

Because you didn't tell it to say that. When you run the program from the IDE, that message appears because the IDE told it to. When you run the program from the command-line that message will not appears unless your program tells it to.

>>while(b.get_account_number()!=-1)
That is an infinite loop. The value returned by that method never changes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will have to completely rewrite the file.