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!");
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!");
Don't waste the time for writing random pieces of codes. You have rather serious task, start from the Project Plan.
You must study some theoretical issues before to start your program design. Search INET for random number generation theory and basics of statistical simulation. Wikipedia is a good start point for your studies.
It's absolutely uninteresting thing to ask your system about any runway or airplane status. The main goal of any statistical simulation program is to produce then save for future analysis all required statistics (see your project specifications). So don't rack your brains over simulation menu switches and displablabla family functions. You need two different programs (airline network file generator and simulation engine) with minimal interactiveness.
It seems you have too restrictive requirement:
You are free to choose the random number generator and priority queue you wish to use, but you must implement these from scratch (as opposed to using a canned library).
Really good random number generator implementation "from the scratch" is more compicated task than all the rest of your project. In practice all serious people in simulation world use professional-made generators (such as famous MersennTwister implementation). I think, you may extract some codes from the public domain implementations (search INET again). Good uniform distributed pseudorandom numbers generator is the key point of any sucsessful statistical simulation package. It's so easy to get exponentially (or what else) distributed random numbers from uniform random stream. No ready to use functions in C …
cout << "What object do you want?";
. May be, come back to design stage (or earlier)? In actual fact, your objects have the only attribute - name. The user can identify (type in) object name. Possible search results: yes or no, found or not found? Think before coding...vector<objects>
- apropos, strange class name for only object with a name). May be, better prototype (and header) for this function is:int SearchVector(const vector<objects*>& allObjects, const string& aString);
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...
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...
The only way to search in std::vector - scan the vector with iterator (from begin() upto end())) and compare search string with (*iter)->name.
If you want fast (better than linear) search, see std::map class with find member function.
Apropos, it seems you need delete *iter;
, not delete (*iter)++;
. See what happens in your case:
- Dereference iterator - get a reference to pointer to object (from the vector) - delete the object via this pointer- increase THIS POINTER in the vector. Why?
The answer: yes, it's legal - but totally senseless. It's the same as:
int main()
{
12345;
return 0;
}
If you want, we call int "constructor" then immediatly discard created object. So internal constructor in actual fact creates local (in outer constructor body) object of the same type. Of course, after closing semicolon destructor was called.
Try this for the constructor with 1 arg (simple and clear code):
#define STD_NUMBER_OF_COLMS 1 //standard number of columns
MyFileExtractor::MyFileExtractor(string fname):name(fname),
columns(STD_NUMBER_OF_COLMS)
{}
If you need lots of constructors, move common codes in a private member function then call it in every constructor. It's a standard way to go.
These typedefs and macros were created by MS team in early Windows era in the interests of portability.
See brief summary and historical introduction:
http://en.wikibooks.org/wiki/Windows_Programming/Handles_and_Data_Types
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...
Use a classic approach (come back to 60th;). See, for example:
http://everything2.com/index.pl?node_id=1293134
http://scriptasylum.com/tutorials/infix_postfix/algorithms/infix-postfix/index.htm
http://cis.stvincent.edu/html/tutorials/swd/stacks/stacks.html
Of course, these three links are not ideal, but...