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

a cat, a dog, two kids and two grandkids.

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

I wouldn't go with the microsoft products because they are too resource heavy, and are too complex for simple things.

That's probably true for students, but not for real-world huge projects. VC++ 2010 beats the hell out of all other competitors when it comes to large-scale MS-Windows programs which contain hundreds of *.c, *.cpp and *.h files and multiple projects that depend on each other all of which are developed by a large development staff (20+programmers).

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


Do you know I can still re-size the array without using realloc though?

Thanks

Yes you can, but you'd have to just duplicate the realloc() function. All it does is allocate a new pointer of the desired size, copy the data from old to new pointer, then finally free() the old pointer.

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

>>store_x_postions[ size] = random_x_pos;

Above is incorrect -- must be (size-1) so that when size == 1 then the correct index value is 0, not 1.

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

Do you mean compiler or IDE?

In many people's mind they are one and the same. In some cases they are while in others they are not. Code::Blocks is an IDE, not a compiler and AFAIK it can be configured to work with most modern compilers.

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

You're right -- I had never noticed that VC++ 2010 Express contains that header file. But I don't know if it was included in VC++ 2008 or not, better check the include folder.

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

But C doesn't have the heavy burden of carrying all those '+'s around all the time, so that makes it lighter and quicker. Similar in comparison to an old overweight man (me) and a young spring chicken (Dani) :)

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

I think regex is part of boost libraries.

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

I hate to tell you, but that is a C program, not C++.

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

Depends on the operating system. MS-Windows I'd say its vc++ 2010. *nix it would be either g++ or Code::Blocks. For portability between the two operating systems (and I think MAC too) it would have to be Code::Blocks.

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

:sad:<sigh!>

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

friends you are telling vc++ 2008.but i m asking vc++ 6.0 only.because this version i m doing job....

You can't read very well can you??? See this post

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

AD,
OP have only 2 posts and you have seen three? Are you becoming older at 120kmph

He sent me a PM with the same question. That makes 3. :)

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

So you are using gnu c compiler? such as gcc or g++? How to do inline assembly with gnu compiler may be a little different than how it would be done in a pure assembly source file with *.asm extension. I don't know how its done with that compiler.

Don't confuse ASCII and db instruction. db declares a single byte of data, which can contain any value between 0 and 255. ascii is a character set that falls within that range. There are other character sets, but ascii is the most common for most of us. See this common ascii chart.

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

One is not better or worse than the other. C is more appropriate in some applications while c++ may be better in others. It all depends on the application to be coded and the hardware on which the program will run.

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

After converting the string to int using atoi() you can simulate division by a series of subtraction.

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

Happy Birthday! Sorry, but I can't make it, so instead I'm sending you lots of virtual kisses :)

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

>>char reg_confirm[256];

>>reg_confirm = (char*) malloc (sizeof(char)*llSize);

Its not possible to call malloc to allocate memory for reg_confirm since reg_confirm is not a pointer. Your compiler should have produced either an error or a warning about that.

>>if (reg_confirm == NULL)
reg_confirm will never ever be NULL because it is not a pointer.

>>if (reg_confirm == "0")
You can't compare two character arrays like that. You have to call strcmp(), like this: if( strcmp(reg_confirm,"0") == 0)

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

A char in assembly is declared as db (one byte), and function 01 of int 21h (MS-DOS) returns a single character (link here)

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

you can't. atoi() converts a string into an integer, has nothing to do with division.

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

First, if you want a 6-digit password then the variable must be declared as 7 characters to allow room for the null-terminator that cin will add.

There are several ways to do this (and more efficient ones too), here is one of them.

bool flag = false;
for(i = 0; i < 6; i++)
{
  if( !idigit(password[i]) )
  {
    cout << "Wrong password\n";
    flag = true;
    break;
  }
}
if( flag)
{
  // go back and ask for password again
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In the original question, X means multiplication, not some unknown variable (the same as * in C and C++ languages).

Azmah commented: you're proving my point ;D +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you want your program to do other things in the meantime? If you do, then put the alert messages in another thread, but your compiler may not support multi-threaded programs. So an alternative might be to use a loop

time_t t1, t2; // time variables
double dif;
t1 = time(0); // get current time
while(true)
{
   t2 = time(0);
   dif = diftime(t2,t1);
   if( dif >= (double)(15 * 60) ) // if 15 minutes expired
   {
      // display alert message
      //
      // reset timer
      t1 = t2;
   }
   // do other stuff here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is the third time I've seen this same question posted by the same person. Please see my answer in your other threads and PM.

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

friends

i am learning visual c++ 6.0.i need to know how to connect the database(oracle).can you tell me how to do??.give me some example....
mfc application connect to oracle database,any example ???


thanking you

Tutorial here

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

plz tel 12 to 24 hors conversion?

This is 2nd grade math problem. If the hour is 12:00 noon to midnight just add 12 hours.

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

It was never excepted math, at least not since the stone ages. One way to think of the problem is like this: You bought 2 widgets for $10.00 each, plus it will cost you $6.00 shipping/handling for both of them. I hope you won't pay $80.00 for that :S If you will, then I have more widgets I'll sell you.

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

There are several excellent books -- here are a few

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
ch = getchar();
if( ch == TerminatingCharacter)
{
   // flush all remaining characters
   while( (ch = getchar()) != EOF)
      ; // do nothing
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you live in USA you can get BBC America and watch Dr. Who as well as other sci-fi shows. If you don't, then you can watch them on www.hulu.com or Netflex.

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

If all you want is a pretty windows to show Thanks then just call MessageBox() from your console program. You don't need WinMain() to do that.

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

have you considered just ignoring all characters after the Terminate command is received?

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

That's exactly what strchr() will give you. It returns a pointer to the fist instance in ARRAY that contains the character in text[j]. Now to get the integer index just simple subtraction -- the pointer returned by strchr() - ARRAY.

char* ptr;

if( (ptr = strchr(ARRAY, text[i][j]) )
{
    index_t[i] = ptr - ARRAY;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> if(text == ARRAY[j])

That is trying to compare an entire string with a single character. For example: if( "Hello" == 'A') ... it just doesn't make any sense.

I think what you have to do is loop through each character in text to see which ones are contained in ARRAY.

for(int j = 0; j < text[i].length(); j++)
{
  if( strchr(ARRAY, text[i][j]) )
  {

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

Solved this problem minute ago..

You mean to tell us it took you 3 years to solve that problem??? :icon_eek:

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

>>error C2447: '{' : missing function header (old-style formal list?)

That error usually means that you put a semicolon after the name of the function, like you did on line 31.

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

@ Ancient Dragon
I have a 404 Error

??? Are you talking about the link I posted in this post? It works for me, I just tried it again.

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

DaniWeb logo on back
"I'm an addict" on the front

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

Use one of the many libraries available for *nix. Here is a good start

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

All standard C and C++ programs are the same regardless of what platform they are compiled for. That means all of them have an int main() function. All (or most) introduction to C programming books will be useful for either MS-Windows or *nix machines/compilers. You won't notice a difference between the two operating systems until you start more advanced programming topics, like sockets and creating GUI windows. But even then there are other libraries available that make those topics portable between os.

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

Those warnings mean that Microsoft compilers now consider standard functions declared in string.h to be depreciated and unsafe to use. You can disable that warning, at your own risk, if you choose to ignore it. #pragma warning(disable: 4996) Put that somewhere at the top (after include files) of the *.c or *.cpp file(s).

You might want to start getting into the habit of using the newer and safer functions that are named in the warnings. Getting ahead of that game now will save you lots of headaches in the future.

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

Don't get hung up on the i[mgp] construct because its rarely, if ever, used in real life. In my 20+ years programming I've not seen it even once except in an academic text book.

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

>>struct clink *p. *q.

That line is constructed incorrectly. struct clink *p, *q;

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

line 25 is constructed incorrectly. Should be: if( (options == 'A' ) || (options == 'a') Notice it used || or operator, not a comma operator. Same problem with line 72. Do not use the comma operator when the || or operator is intended.

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

I think that's a pretty good guess. If anyone has any link to a reference explaining this mechanism better, I would love to read it.

Here is a related thread

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

Sounds like you are asking for inter-process communications or client/server. Yes its possible, how to do it depends on the operating system and probably the compiler.

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

Multiple instances of the same string literal becomes even more interesting. Some compilers have an option (switch) that allows the compiler to combine all instances of the same string literal into just one instance. So if you have coded the string "Hello" multiple times the compiler will generate just one instance of that string. If that switch is not set then the compiler will include multiple instances of the string in the program, thus increasing program size. You will have to read the compiler's docs to see if such a switch is available, and if not then how the compiler handles it.

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

iostream.h is obsolete. use <iostream> instead (notice there is no .h extension).

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

It's in System.Threading namespace -- link here

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

From what I remember C++ was a good time. But C# blows it out of the water if you like getting your work done in time for beers and the hockey game.

That may be true where .NET framework is available, but there are only a few operating systems that have it available. It will take decades for C# to achieve the portability that C++ has.