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

I like your sig too!

Bet you can't guess where I got the idea ;)

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

It's easy to spot pot users, they lean to the left!

I didn't realize President Bush and his family were lefties (Bush himself was a drug abuser and alcoholic) :) pot apparently doesn't discriminate by political leanings.

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

I don't use *nix but it sounds like a memory leak if there are only a few threads running at the same time. Could also be a limitation of the max number of open sockets at the same time.

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

don't know --- try 127.0.0.1 and find out if it fixes your problem.

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

how can i compare the last LINE of my file with others line of my second file to merge them.

I'm not going to give you free code for this one -- it'll cost you lots and lots of $$$$. But you can get free help here if you try to do it yourself and post your attempt.

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

NFL Commissioner Roger Goodell is determined to turn the sport into a global game and he will be encouraged by the crowd's enthusiastic response to their ground-breaking initiative.

I suspect the large turnout was because it was a novalty. American football in europe would probably be as popular as european football is here.

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

For the older readership, dig out some of the videos of the late Bill Hicks, then try to justify your asymmetric position on the drugs issue.

Never smoked pot, but when I was in college Speaking class of some sort during 1970s I started out to prove that pot was a dangerous drug. I read every medical book I could get my hands on at the local library that discussed the topic, and made a huge chart that showed book title, author and conclusions. Result: when I made my presentation I was convinced smoking pot is no more dangerous than alcohol, not one doctor could prove that pot caused any long or permanent problems and was less addictive thn tobacco. BTW that speech got me an A in the course :)

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

Only problem is I can't use maps or any of that fancy jazz.

tutorial

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

Any way to get just a quick list of just the thread titles so that the list doesn't cover so many pages of the cplusplus snippets (and others too)? Then if I see one that I might want to look at in more detail I could hover the mouse over it and a popup will appear that contains the rest of the text, much like it does on other boards.

iamthwee commented: gggggggggggggggggreat sig +13
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

OK thx ,
but plz say me how can i open another temporary file can u give me an exemple

Ok here is a very very simple example. I didn't compile or test this so it might contain errors, but it should give you an idea of what you have to do.

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

int main()
{
    string line;
    // open input file
    ifstream in("infile.txt");
    if( !in.is_open())
    {
          cout << "Input file failed to open\n";
          return 1;
    }
    // now open temp output file
    ofstream out("outfile.txt");
    // loop to read/write the file.  Note that you need to add code here to check
    // if you want to write the line
    while( getline(in,line) )
    {
         out << line << "\n";
    }
    in.close();
    out.close();    
    // delete the original file
    remove("infile.txt");
    // rename old to new
    rename("outfile.txt","infile.txt");

    // all done!
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

example. Note placement of braces and spacing. For more information read this by the author of the c++ language.

#include <iostream>
using namespace std;


int main()
{
    std::string line;
 
    int i, p, x;
 
    for(i = 3; i <=100; i++) 
    {     
       for(p=2; p<i; p++)
       {
            if((i%p) == 0) 
                x = 0;
       }
       if(x != 0) 
             cout << i << " is prime\n";
       x = 1;
    }
    getline(cin,line);
    cin.get();
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The formatting is terrible, maybe you have a mixture of tabs and spaces. I think you have a couple misplaced braces.

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

Here is an example of using pipes in MS-Windows programs. Scroll down a bit and there is some example code.

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

What is the question -- I didn't see one ? If that is really the code you have written then its wrong. Line 48 is an extraneous brace and lines 53 thru 61 need to be inside some function.

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

I'm suprised that KKK guy didn't get himself shot or hung up by his b***ls

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

or a brain fart.

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

Did she answer the question?

No -- just a lot of gobbledeygook, just like our politicians. She would make a great politician!

The term was coined on March 30, 1944 by Maury Maverick, chairman of the United States Smaller War Plants Corporation. In a memo banning "gobbledygook language", he wrote "anyone using the words activation or implementation will be shot".[1]

We had a long discussion about using that phrase here not too long ago. :)

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

>>could you explain me how to use this function in simple words?
No because I have never had a need to use it. If you are going to use win32 api very much then you absolutely must learn enough English in order to understand the instructions. But don't feel too bad if msdn is difficult to understand -- most native-English speaking people have problems with it too.

Here are some google links that may help

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

A vector is just a c++ array and pretty easy to use. Here are the basic functions that you can use. For more indepth information see this tutorial.

#include <vector>
#include <string>
using namespace std;

int main()
{
    // declare the vector of strings
    vector<string> theArray;

    // add a string to the vector
   theArray.push_back("one");

   // get the number of elements in the vector
   int numElements = theArray.size();

   // display all strings
   for(int i = 0; i < theArray.size(); ++i)
       cout << theArray[i] << "\n";

  return 0;
}

In your case, if you want an array of Customer objects, declare it like this

vector<Customer> custArray;

And you can have vectors within classes too. Each customer might have more than one video

class Customer
{
  <snip>

protected:
    vector<Video>  videoArray;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since we don't have the complete code to that class it's not possible to answer your question.

line 9 is the wrong brace -- maybe just a posting error ?

line 8: this is a pointer and requires pointer notation this->

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

like the title says, how do I play sounds?

depends on the operating system. In MS-Windows call PlaySound() win32 api function and include windows.h header file.

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

Learn to format your code better so that you can see what you're doing. Only takes a couple seconds to hit that space bar.

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

that doesn't look like any assembly I know of. But basically divide the number by 10 and the digit you want is in the remainder part.

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

merged two threads and moved to C board.

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

closed thread

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

You need to put a return after line 18 is executed because there is no point contuining that function if it fails to open the file.

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

two chilidogs, glass of unsweened ice tea and a small bowl of popcorn.

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

did you try google ?

A better solution would probably be to download the boost library because I think it includes something like that.

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

Probably have to do it in a separate loop, something like this:

class CParticle
{
public:
    CParticle(int x = 0)
    {
        initialize(x);
    }
    void initialize(int x = 0)
    {
        m_x = x;
    }
private:
    int m_x;
};

int main(int argc, char* argv[])
{
    CParticle* parts;
    parts = new CParticle[100];
    for(int i = 0; i < 100; i++)
        parts[i].initialize(1);

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

you will need an array of strings. There's a couple ways to do it

// this array will hold up to 100 names and each name can be up to 19 characters long.
char names[100][20];

// This is a c++ array that can contain an unlimited (almost) number of names
// and each name can be unlimited (almost) length
vector<string> names;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>bytes0-6= short unsigned int big endian
are you sure that's right? 0-6 is 7 bytes and sizeof(short) is only 2 bytes on most 32-bit compilers.

>>byte7 = int
No it isn't -- sizeof(int) on 32-bit compilers is 4 bytes. 1 byte is just a char.

>>bytes8-23= float little endian
sizeof(float) is not 16 bytes but only 4 bytes. Maybe you mean that contains 4 float values ?

Run the below to verify size of data on your machine

#include <iostream>
using namespace std;

int main(int argc,char* argv[])
{
    cout << "sizeof(sort) = " << sizeof(short) << "\n";

    cout << "sizeof(float) = " << sizeof(float) << "\n";
    cout << "sizeof(double) = " << sizeof(double) << "\n";
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

for the record: I wasn't serious about the water being harmful......

You should have been because water is very harmful in some countries. And if you travel outside your own country you have to be careful of the water you drink because your body may not be accustom to the bacteria that's in the water. I met a guy from Austrilia who told me he can't drink the water here in USA because it makes him sick.

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

Are Windows SDK and DirectX SDK installed necessary, for both VC++ and dev-c++?

For VC++ 2005 Express yes, don't know about DEV-C++. After you have downloaded and installed them you have to configure the compiler's IDE with the paths to the include and lib directories.

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

line 36: filename needs to be defined a lot larger than that. If you are using MS-Windows operating system the max filename is 260 (or MAX_PATH if you include windows.h)

>>how do i stop displaying text after question D)
I suppose you mean that do loop that starts on line 56? change it to a while loop, then you can delete the checks for EOF inside that loop.

while( (mc=getc(fin)) != EOF)
{

}

>>and prompt for an answer which then has to be converted to a number

int answer = 0;
printf("Enter a number\n");
scanf("%d", &answer);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

ex printf("%s",string)
scanf("%s",&string)

Those statements are the same because string is defined to be a character array and not a pointer The & address operator in front of string is optional because both produce a pointer to the first byte of the string. Both lines below produce identical results.

int main(int argc, char* argv[])
{
    char string[] = "Hello World";
    printf("%s\n", string);
    printf("%s\n", &string);

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

Thanks a lot, may I ask what was the std:string line; and the getline(cin,line) for?

I guess I wasted board banwidth making my previous post :) Did you read the writing or just skip over it and looked at the code ?

BTH you will have to include <string> in order to compile that code.

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

delete line 3 because your program doesn't need math.h

and learn how to use code tags so that I don't have to add them for you.

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

The internal code produced by your compiler most likely is the same for both functions, so there would be no difference in memory requirements. The difference between the two functions is the c++ language requirements, compilers may implement them however it wants to.

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

The reason you have that problem is because you hit the Enter key after entering the integers, so the '\n' (Enter key) is still in the keyboard. The next line says to get anything stil in the keyboard. In your first example there was nothing in the keyboard buffer so the program waited for you to type something. But in the second example the keyboard buffer still had '\n', and cin.get() used that.

To fix that problem you need to flush the input keyboard buffer of all remaining keys. There is no really good reliable way to do it, but using getline() will work ok for most purposes, like this:

int main ()
{
    int a;
    
    cout << "Hello World, how are you?";
    cin >> a;
  cin.get();
 return 0;
} int main ()
{
    int a;
    std::string line;    
    cout << "Hello World, how are you?";
    cin >> a;
    getline(cin,line);
  cin.get();
 return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> are theses methods equvilent
yes (almost). There are a couple things that can be done with pointer num that can not be done with the reference.

>> or does one method require more memory than the other?
no

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

please post complete example -- what you posted doesn't make much sence.

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

This pole was quite easy to answer because EVERYBODY knows that politicians all around the globe are liers and cheaters. Sometimes thay have to be like that in order to protect national secrets -- but not all the time, especially around election time.

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

There is a third option: declare eval_container in main() and pass it around to the other functions.

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

It means the function is going to return a pointer to a double variable or possibly a pointer to an array of doubles. The * means a pointer.

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

The second example is illegal syntax, maybe you meant this? pp = (int**) malloc (m*sizeof(int)) The first example is ok in C language but not in C++, which requires the return value of malloc() to be typecast to the appropriate type of variable. Other than the typecast they both are identical.

And BTW you shouldn't expect people to respond so quickly to a question.

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

>> i can figure it out myself, but might not be too efficient.
Thats ok if its not very efficient -- post what you have

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

did you try google ?