General C++ Programming - February 2017 (Page 4)

by vgdd
Adding player 2 to Nim
 
Hey! This is my code so far and it works fine but Player 2 cannot win only Player 1. Anyone know how to fix this! #include <iostream> #include...
[1 reply] : Without giving any code because I'm at work, your code needs to store ... (by rcast)
Help with c++ calendar
 
I need some help with setting up an output file for my full year calendar and displaying the start date for every month(I have a day of the week formula, but im...
[4 replies] Last: @oatmeal678 I tried different things with your dayofweek function, an... (by whitenite1)
Problem with error message creating an instance of a struct
 
This is the error I am getting on the "return *node1" Error: no suitable conversion function from "BinaryTreeNode" to "int" exists BinaryTreeNode* node1 = ne...
[1 reply] : You're returning a BinaryTreeNode object by value from the function. D... (by gunnerfunner)
by helios
Simplifying template code
 
I have the following function: template <bool V> struct conditional_assignment{}; template <> struct conditional_assignment<false>{ template <typename T1...
[3 replies] Last: Maybe conditional: http://www.cplusplus.com/reference/type_traits/con... (by coder777)
by masol
how to embed opencv library inside visual c++ 2010 using lib
 
Hi. i want to embed opencv library inside visual c++ 2010 using lib. i do this work but my exe file that created run only in my local system. i want to use it i...
[1 reply] : Did you read this http://docs.opencv.org/2.4/doc/tutorials/introducti... (by coder777)
Level of Nested for loop in c+
 
I have written a c program with 256 nested for loop. But, I have heard that it is not possible to run this program in C. But, I have also heard that we can run...
[2 replies] Last: > I have written a c program with 256 nested for loop. This is fundam... (by JLBorges)
How to fix this in Linear Search?
 
This is my program code for my linear search program. The condition of my professor was to generate a random set of numbers and the user should declare the numb...
[7 replies] Last: Yes, thanks Peter87 , you are right. (by Chervil)
the code terminates before i even initialize the inputs
 
#include<map> #include<iostream> #include<vector> int N=0; struct Node{ int index; std::vector<Node> * Linked; }; class tree { public :...
[6 replies] Last: Netbeans is a piece of junk , im downloading VS2015 <3 Thank you Ne55... (by zeroblank)
Deleting items from map while iterating problem
 
So in my code: //triggerEvent is called in engine update every frame. void EventManager::triggerEvent(sf::Event* event) { if (!listeners_.count(event->ty...
[6 replies] Last: This works perfectly! Thank you very much helios :)! (by Putarda)
Need help with Portable program missing dll
 
Hello every one. I am using visual Studio 2017 RC to write a portable calculator (run in Ms-dos environment). It run perfectly on my laptop (win 10) however, i...
[3 replies] Last: You have to use the XP toolset if you want to run on XP. There's no ot... (by helios)
Unable to display two objects through a class of link list with a union method
 
I am having trouble displaying my method for link list. I either display obj1 or obj2 but I can't figure out how to display both at the same time. The method I ...
[no replies]
Pointer won't point at beginning address in array
 
This code is designed to count the words in a string, but that's not my concern right now. It's not finished yet because I ran into a problem I can't understand...
[1 reply] : Lines 32 increments string3. After each increment, string3 refers to... (by dhayden)
How to declare and define class member functions separately using template.
 
Hi, I am trying to write a template class, in which member functions are declared with class definition and defined outside class definition. But getting the f...
[2 replies] Last: Thanks @ne555 for pointing that out :) Wat a silly mistake :( (by kapil2905)
Unable to exit program properly
 
Hello I am wondering how I could have the user enter "exit" in the update read and have it end. I thought about creating another string variable for the exit co...
[2 replies] Last: #include<iomanip> #include<iostream> #include<string> #include<algori... (by JLBorges)
Error message leaves me hanging
 
I am taking a long shot here, but I wonder if the error msg I am getting when trying to compile my program is somehow specific to a particular problem or style ...
[1 reply] : Is this message specific to something or is it some generic statement... (by cire)
stack and queue commenting
 
I am having difficulty in adding well explained comments to this code. does anyone have any help please or guidance? #include <iostream> using namespace std...
[2 replies] Last: IMO, a lot of your code doesn't really need comments. If one chooses m... (by TheIdeasMan)
Code compiling in Visual Studio but not g++
 
I have the following program that seems to compile and run fine in Visual Studio, but I can't compile it with g++. #include <iostream> #include <fstream> ...
[6 replies] Last: Also consider updating your compiler. g++4.9 is pretty old now. g++6.3... (by TheIdeasMan)
structs array sorting
 
i have a question about sorting the array member function with arrays and structs im trying to make a function that it going to order the apply dates which is t...
[9 replies] Last: i got it nevermind i figure it out (by ghost1111)
Recommendation for books about Parallel programming C++
 
Can anyone recommend me good books about Parallel programming in C++? Better with examples. Thanks, L
[5 replies] Last: Regarding the point about parallel programming vs threading - yes, poi... (by dangrr888)
Why ifstream unable to read csv data ?
 
#include<iostream> #include<fstream> #include<string> int main(){ int id; string name;char comma ; double money; ifstream read("test.csv"); while (read ...
[4 replies] Last: Just ignore what I said earlier. I wrongly assumed, based on the name,... (by Peter87)
February 2017 Pages: 123456... 16
  Archived months: [jan2017] [mar2017]

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