107 Posted Topics
Re: Rather than DayOfTheWeek.getDay, use getDay() Since you are calling a method of the class from withing the class | |
Re: In times of need, Google is your friend!!! [url]http://stackoverflow.com/questions/190229/where-is-the-itoa-function-in-linux[/url] | |
Re: [CODE] #include <iostream> #include <string> #include <sstream> int main() { std::stringstream expression(" 3 + 4 ( 5 * 8 "); std::string token; const char DELIMITER(' '); while (std::getline(expression, token, DELIMITER)) { std::cout << token << std::endl; } } [/CODE] | |
Re: You might want to consider to first break the problem into set of points (x,y). Then extract and convert each set of points to numbers. | |
Re: It would be good practice to always check your return codes. If you do so, you will most likely find your error. | |
Re: Yikes, is that really Andrew Koenig or a very good Impersonator!!! | |
Re: 1. Ofcourse newbies can learn C++!!! 2. Not a game programmer, but I suspect lots of games use c++ since performance is important 3. I use a mac at home, linux/windows at work. You already have everything you need. a. open a terminal window on your mac b. type nano … | |
Re: Interesing syntax, I thought array initialization has to be a constant??? Is'nt that going to go out of range and cause all kinds of interesing problems? since i is incremented further down... int i = 0; int sales[i]; | |
Re: Below is a example of one way to remove an item from a vector using an iterator. [CODE] class Eraser { public: Eraser() { _vector.push_back("fred"); _vector.push_back("alice"); _vector.push_back("billy"); } bool remove(const std::string &who_) { for( TVec::iterator i=_vector.begin(); i!=_vector.end(); ++i ) { if( *i == who_ ) { std::cout << who_ << … | |
Re: You are on the right track, below is sample of array using index and pointer. [CODE] #include <iostream> int main( int argc, char *argv[]) { const size_t LIMIT = 8; int buffer[LIMIT] ={0}; // array access using index notationn for(size_t i=0; i < LIMIT; i++) { buffer[i] = i; } … | |
Re: According to 2003 C++ Specification this is legal. An array with no elements is created. | |
Re: A problem unique to multi-core is that each core has its own cache and caches between cores must be synchronized if different threads are accessing the same variable. So you may get into a situation where a shared resource has different values in the different cache, i.e. the caches did … | |
Re: Do you know how to use classes yet? It would be cleaner to model your problem using classes. | |
Re: Are you trying to define the implementation outside the class like below? [code] class SomeClass { public: void doSomething(); }; void SomeClass::doSomething() { } [/code] | |
Re: Access first letter using index 0 not 1, but make sure user entered a middle name by checking size() [code] int main( int argc, char *argv[]) { std::string middle; std::cout<<"Enter your middle name: "; std::getline(std::cin,middle); if( middle.size() ) { std::cout << "middle initial is=[" << middle[0] << "]" << std::endl; … | |
Re: Learn to think and model your problem in terms of objects and object interactions. The c++ language constructs lets you model your ideas into code. Search Google for "c++ object class design" for more information. |