Is there a built-in function that comma-separates a number in C, C++, or JavaScript?
Given a number 12456789, I need to output 12,456,789 without much coding. Are there any built-in functions in either C, C++, or JavaScript I can use to do that? ...
Given a number 12456789, I need to output 12,456,789 without much coding. Are there any built-in functions in either C, C++, or JavaScript I can use to do that? ...
I am porting some C++ code from Unix to Linux (Red Hat). I have run into the following pattern: ostream& myfunction(ostream& os) { if (os.opfx()) { os << mydata; os.osfx(); } return os; } The functions opfx and osfx are not available under Red Hat 4.5. I saw a suggestion here to use the ostream::sentry functionality:...
I am trying to print print out an array of integers whose length i dont know in C++. Here is my attempt. int i = 0; while ( X != NULL){ cout << *(X+i) << " "; i+=1; } X is the array. My problem is to stop upon printing last element. ...
Hi, My question is with reference to this question which explains how virtual functions work in case of object slicing which end up calling base class virtual function and Wikipedia article which explains the virtual table layout for a derived class for below code class A{ public: virtual void func(){ cout<<"\n In A:func"...
Hi! Guys, I need to find a good site like codingbat to "learn again" C++. I learned it at school but then I've never used it seriously. I'm not looking for something like Project Euler because it focuses on math problems. I need something really focused on C++ principles, chacteristics and tools. ...
How to save QListView items to text file? ...
I'm trying to implement generic method to put in a class a calculated value as a read-only memver value. I've successfuly acomplished it using the following macro: #define READONLY_PROPERTY(datatype, containerclass, access, name)\ class name ## _ ## datatype ## _ROP {\ public:\ name ## _ ## datatype ## _ROP(containerclass &c_):...
void weight_data::rev_seq(string &seq){ //TODO std::reverse(seq.begin(), seq.end()); } In this C++ method, I think this method does not return anything, so the prefix is void, what does :: tell the relationships between weight_data and rev_seq(string &seq)? Thanks! ...
I've sublassed QSqlRelationalTableModel for one of the tables in my app. Basically I've added custom header data and custom flags so some columns are non-editable. Also a custom setData() function to reject null primary keys. The table's edit strategy is QSqlTableModel::OnRowChange. My app has a button that inserts a new row when pressed...
Hello every body I am looking a tool able to detect ordered function call pairs in a nested fashion as shown below: f() // depth 0 f() //depth 1 g() g() At each depth of call f() there must be a call of g() forming function call pair. This is particularly important in critical section entry and exit. ...
Why wouldn't C++ allow something like that ? I need to have multiple priority queues, the number of which would be determined at run time. This fails to compile std::vector<std::priorityqueue<Class A>>. Is there a better approach ? ...
I'm using c++ OpenFrameworks and ofx3dModelLoader to load in 3ds models that I've already created. This is working great. However I would like to smoothly transition models visually as the enter the frustum's back plane. I have fog working but would really like to fade the models in from transparency. Is there any way to do this eithe...
Hi, I have created a map with ClassExpression as the key and std::string as the value. The key comparator is given below class ClassExpressionComparator { public: bool operator()(const ClassExpression& lhs, const ClassExpression& rhs) const { return ((lhs.quantifier == rhs.quantifier) && (lhs.p...
Possible Duplicate: Default Keyboard Settings And Definitions Hi everyone, I'm new to C++ and trying to get a hang of the program. I'm very, very unfamiliar with the keys definitions and whatnot. Can some one provide me with a list of the default layout of the C++ keyboard and a definition for that key? as I'm finding it hard...
Hi, I'm a Java developer primarily, dabbled in a little C# but mainly Java. So I have wanted to get into C++ development for some time now but have not found any on-line tutorials that I liked or are modern. Just so you know I've been developing in Java for about 3 years now and I would like a beginner level book to introduce me to every...
I have a template class MyTemplate. It works fine. But as soon as I create another class that derives from it, I get errors. //main.cpp template <typename T> class MyTemplate { public: T* test() { return new T(this); //error here. } }; template <typename T> class MyTemplate2 : public MyTemplate<T> { }; ...
Is there a way to use member functions in the specification of composite_key's in boost multi_index_container's? #include <boost/multi_index_container.hpp> #include <boost/multi_index/mem_fun.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index/composite_key.hpp> #include <boost/multi_index/member.hpp> #includ...
Is there a library that can load controls (buttons, text boxes, etc.) from an xml file? Kind of like in WPF. ...
I'm trying to read an Xml file recursively using Tinyxml, but when I try to acces the data I get a "Segmentation Fault". here is the code : int id=0, categoria=0; const char* nombre; do{ ingrediente = ingrediente->NextSiblingElement("Ingrediente"); contador++; if(ingrediente->Attribute("id")!=NULL) id = atoi( ...
I read about adjustor thunk from here. Here's some quotation: Now, there is only one QueryInterface method, but there are two entries, one for each vtable. Remember that each function in a vtable receives the corresponding interface pointer as its "this" parameter. That's just fine for QueryInterface (1); its interface ...