General C++ Programming - February 2019 (Page 11)

by Mk87
important question
 
how its possible to add a destructor for the following Foo class? #include <iostream> class Foo { public: Foo() { std::cout << "Foo constructor 1 ca...
[9 replies] Last: See the discussion here for a kind of pessimized example of an explici... (by mbozzi)
Breakfast Menu Program help
 
Hey guys so i am doing a c++ program where the user picks items from the menu and it shows the sub total, tax and grand total. Everything seems to be working bu...
[2 replies] Last: This is how I would have implemented what you mentioned. Changing a co... (by H00G0)
Writing data to an open Excel file using COM OLE C ++
 
Good evening, Can you please help me, if anyone has a sample Excel file for reading and writing data using COM / OLE in pure C ++? There is an example of ...
[4 replies] Last: It is not true. Can replace: IDispatch *pXlApp; hr = CoCreateInst... (by Android1)
Issues with memory leak
 
I am using the boost library serialization feature and i am having issues with saving my object data. When i used Visual leak detector i found multiple leaks in...
[5 replies] Last: Run the offending code in as small a sample program as you can build t... (by jonnin)
shifting elements of a container
 
I played a little bit with the rotating of container elements (after I saw a possible solution here in the forum). I made a rotating function which works on...
[1 reply] : See https://en.cppreference.com/w/cpp/algorithm/rotate#Possible_implem... (by JLBorges)
Modifying array to get equal frequency of each element!
 
I have an array, say A which consists of N elements say: a1, a2, a3 ... aN. The question asks me to change some elements of this array so that the frequency of...
[8 replies] Last: When I said "remove an element" I was saying it as a shorthand for "ov... (by helios)
by Path88
Vector problem
 
class EnemyShips { glm::vec2 position; glm::vec2 dimension; }; main() { std::vector<EnemyShips*> m_ships; - with 5-6 elements } How do i get positi...
[1 reply] : m_ships .position; //but, position is private here, you need to make i... (by jonnin)
by NKGold
Help
 
Im trying to make a simple program that reads 8 non-whitespace characters from the keyboard and form a string, EightChars, using the string .push_back() functio...
[4 replies] Last: This is what I have but it dosn't work. #include <iostream> #include ... (by NKGold)
Towers of Hanoi - 5 peg, 1-10 disks
 
So I an working on a program to solve the Towers of Hanoi puzzle with an extra rule. The disks must follow a graph with edges: (start, a1), (a1,a2), (a2,a3), (a...
[1 reply] : I changed line 63 to Hanoi3(a1,a1,a2,a3,dest,n-1,false); and added a... (by Metal488)
by Allaye
'Blending::Blend': non-standard syntax; use '&' to create a pointer to member
 
----------header file------------ class Blending { public: Blending() { } void Blend(int, void*); double alpha, beta; int key; ...
[6 replies] Last: Am sorry that isn't the case, i actually tried your link but couldn't ... (by Allaye)
by Mk87
question
 
unfortunately, my code contains a memory leak. how to remove the leak? class Base { public: virtual void doSomething() = 0; }; class Derived : public...
[3 replies] Last: The destructor in class Base is not virtual , so line 18 delete ... (by JLBorges)
Redirect stdout to File, Exception Safety
 
I have written a method which redirects stdout to a file: /* Redirects stdout to file. */ void OutputController::stdoutredi(const std::string &filePath) ...
[4 replies] Last: It definitely does crash in printf. Although I don't understand the co... (by HermanNordberg)
February 2019 Pages: 1... 91011
  Archived months: [jan2019] [mar2019]

This is an archived page. To post a new message, go to the current page.