ArkM 1,090 Postaholic

Well, try it then post...

ArkM 1,090 Postaholic

You have absolutely useless inner while loop. Replace it:

if (ventas_vendedor > aux_ventas)    // here i have the max sells made	
{
    aux_ventas = ventas_vendedor;
    vendedor = 1;    // Now we have one and only one leader!
}
else if (ventas_venderor == aux_ventas)
    ++vendedor;     // addition to the family...
ArkM 1,090 Postaholic

As far as I know, SQLCHAR is a typedef for unsigned char* (or signed char* in other versions). If so, use brutal force method (in C style):

strcpy((char*)szString,"Let's Try This!");
Frederick2 commented: helped me a lot. i was stuck +1
ArkM 1,090 Postaholic

All STL classes are declared in namespace std. Open namespaces with using namespace std; or use fully qualified name as std::queue .

ArkM 1,090 Postaholic

Oh, my God! You typed Pizza...
Input stream errors detection and recovery - see my prev post above...

ArkM 1,090 Postaholic

1. Where is enum food type values or variables in the snippet? Why "error Using Enum type and loops"?
2. If cin >> user_selection failed (for example, type a letter), you never break loop.

if (cin >> user_selection)
{
   // OK, continue
}
else
{
   // cin is in fail (check cin.fail()) or eof (check cin.eof()) status.
   // if you want to continue:
   cin.clear();
   ...
}
ArkM 1,090 Postaholic

1. Please, correct code indentation before send the code next time.
2. Your program performs two absolutely identical actions for Filip and Jimi cases. Why?

ArkM 1,090 Postaholic

Reasonable question, evasive answers...

It's operator new creates new objects of Person class. It returns a pointer to a new passenger and you may add it to the vector of pointers. Be careful: the object must exist while passenger vector exists. May be, using vector<Person> (not vector<Person*>) is the best (safe) variant, but you may use vector<Person*> too - for example:

class Airplane
{ ...
  public: void sellTicket(Person* p)
...
  vector<Person*> passengers;
};

void Airplane::sellTicket(Person* p)
{ ...
  passengers.push_back(p);
...
}
...
Airplane plane(...);
...
Person* p = new Person(...);
plane.sellTicket(p);
...

Now you may use the vector, for example:

class Airplane
{...
public: void print() const
{ // or use vector<Person*>::const_iterator (see std::vector docs)
   cout << passengers.size() << " passengers now:\n"; 
   for (int i = 0; i < passengers.size(); ++i)
      cout << i << ".\t" << passengers[i]->name() << "\n";
   cout << "--- end of list ---" << endl;
}
...
Airplane plane(...);
...
plane.print();
...
};

Don't forget to delete Person objects when the plane crashed...

ArkM 1,090 Postaholic

Of course, you randomize the number of games too. See default choice (in the inner loop) logic. It increments game value in one or two points (the number depends on random values of myPoint and new sum).

You have eight points of game var incrementing on every control path. This is too much!..

ArkM 1,090 Postaholic

The calloc (and malloc) function never calls constructors; free() never calls destructor(s).
So using new and delete operators for class objects (or array of class objects) is not only recommendation or a good style symptom - it's one of the very strict C++ language specifications.

ArkM 1,090 Postaholic

May be this function is infected by extremely malicious stealth virus which is capable to hide not only its binary image but source code too...

Alex Edwards commented: That was hilarious! +2
ArkM 1,090 Postaholic

In other words, you are trying to make choice between a Ford car and Ford Crown Victoria Interceptor. Truth to tell, Microsoft tuning adds 5-th wheel (NET extensions) to this wonderful model...

mitrmkar commented: LOL, metaphor of the week I'd say +4
ArkM 1,090 Postaholic

The 1st code fragment converts hex digit chars (0123456789ABCDEF or ...abcdef) into its binary values. For example: '0' => '\0'(0), ... '9' => '\x9'(9), 'A' => '\xA'(10) and so on. It converts all chars of the C string until end of line or end of string (zero byte) occured.
It's not so good code: you need add else after 1st and 2nd if's in the loop (no sense to compare source byte with 'A' if previously it was equal to '0', for example). All other chars are skipped. This loop packs result bytes in place, from the start of source line (initially ptr == dest).
So, for example:

"s2f\r\n" => "\02\x0F\r\n"

The 2nd code fragment packs two hexadecimal byte values into one byte. For example, in "...\1\1.." string \1\1 pair is converted to (char)17 byte. Now update_crc_kermit function accepts this byte as the 2nd arg. Do it untill the next byte is not in ASCII range (0-127). It's a very dangerous loop because of special break condition. It produces wrong results if input string contains not only chars from the range 0..16. What's a questionable code fragment...

ArkM 1,090 Postaholic

Forget NULL macros once and for all. Use pointer constant 0.
Wait for nullptr reserved word in future standard releases;)..

ArkM 1,090 Postaholic

I see a monstrous fragment in attached code:

string FileName;
    
    char __TEMP__[256];
    cin.getline(__TEMP__, 256);
    
    FileName = __TEMP__;
    delete [] __TEMP__;

Don't continue. You try to deallocate (free) stack (automatic) array. Of course, now program stack is corrupted, program behaviour is undefined and so on...

Apropos, see quote from C++ Standard:
17.4.3.1.2 Global names
Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase letter (2.11) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

So it's not recommended to assign __TEMP__ to your local variables: it's not a good practice.

ArkM 1,090 Postaholic

Use double (~16 decimal digits); 32-bit floats keep only ~5-7 decimal digits.
Always use double type in math calculations!

ArkM 1,090 Postaholic

Don't include <iostream.h>. It's so called old stream header. Say him Nevermore. Use <iostream> only.

You wrote #include <stdafx.h> - Visual C++ precompiled header. Place all subsequent includes in stdafx.h wizard-generated file. No need in math.h, windows.h and stdio.h headers in your program now. You may add them (in stdafx.h) later.

ArkM 1,090 Postaholic

Some addition to dwks's post:
if it were not for structure tail padding, one of the most valuable C and C++ identity

Type array[SIZE];
sizeof(array)/sizeof(Type) == SIZE

was incorrect for some kind of Type's (as a structure from the original post).

ArkM 1,090 Postaholic

Regrettably, it's impossible to get time interval with microseconds precision from standard C and C++ run-time library calls. The best function in this area is clock() but it yields ticks with OS process sheduler time slice precision (near 10-15 milliseconds in the best case).

See your OS manuals: as usually, there is system clock function in OS API. Prepare to get unexpected long intervals (another process was sheduled while you wait i/o or exhaust your time slice).

So Ancient Dragon's approach is more productive (but is not so universal as desired;).

ArkM 1,090 Postaholic

Caret does not denote a pointer. It's MS .NET extention for handler of GC heap object.
See, for example:
http://www.visualcplusdotnet.com/visualcplusdotnet14c.html
Forget portability (in C++?!) with hats, gcnew and other MS VC++ tricks...

VernonDozier commented: Thanks for the explanation. +5
ArkM 1,090 Postaholic
Q8iEnG commented: Thanks for the small help :) +1