General C++ Programming - February 2018 (Page 2)

........
 
......
[4 replies] Last: @macXnXcheese117 Please DON'T delete your posts after you've got your... (by MikeyBoy)
Help with family tree program
 
Hi there, I'm still working on the same family tree program, but I'm having trouble with implementing the addWife and addChild function. Ideally, I want the fin...
[15 replies] Last: I don't think it would be easy for the function displayWifeChildren (w... (by CPPAWhile)
Text based game assignment where I randomly assign objects into an array
 
Hello fellow programmers, I have to place weapons/enemies in random spots in a map and they cannot be in the same spots. I'm not sure how to make it so that the...
[4 replies] Last: Thanks for the information! I'm not quite sure why but when I run it I... (by mikenaria)
Help returning a instance out of scope!
 
I am currently writing a custom string class that uses cstring to store the data. On top of that, I am writing operator overloads. Here is what I'm trying to pe...
[2 replies] Last: delete tempStr.str; tempStr.str = new char[tempStr.cap]; If that ne... (by mbozzi)
Help with recursion sum
 
The sum of {1,2,3,4,5,6,7,8,9} should be 45. Sum is displaying 45. Binary Sum is only displaying 36. int BinarySUM (int Array , int i, int n) { ...
[3 replies] Last: [quote=waranthem]What exactly does n-n/2 do? Basically, n/2 will suff... (by lastchance)
Why Shortest path code not calculating distance to node 6?
 
I have tried code for using Dijkstra's shortest path alg: https://codepad.remoteinterview.io/DOSZEXAGJM It seems to work (does with at least with the tes...
[2 replies] Last: I guess because it was late and I was tired and for some reason just p... (by sonar87)
Problem with Vector of vectors
 
I'm trying to create a grid by user defined parameters, I've done this by creating a vector of int vectors called grid, compiled of int vectors called rows. I'v...
[2 replies] Last: Thank you, i believe i may have it figured out now. I had a few syntax... (by chronasiton)
by Jmac21
Help With program using fork() system for child and parent process
 
This is the orginal question and My code Write a C/C++ program using fork() system call that allows a parent and a child processes to cooperate on carrying s...
[2 replies] Last: #include <stdio.h> #include<stdlib.h> #include <unistd.h> #includ... (by Jmac21)
Adding the sum of the previous value, and continuing from there.
 
I'm trying to write a code where it should add on from the current information. For example, let's say A is 11 for the first and second calculation. B should be...
[2 replies] Last: I tried looking around and trying different things but it wouldn't wor... (by jolamiii)
Help with this program?
 
A society keeps a list of members and uses a program to store the list.For each member, the following information is recorded membership number surname the...
[6 replies] Last: I have to use arrays and there is no sort function for arrays. How... (by Repeater)
deleting primitive and class types pointers.
 
#include<iostream> #include<string> class A { public: A() { std::cout << "constructed." << std::endl; } ~A() { std::cout << "destructed....
[1 reply] : What makes you think the int value isn't being deleted? What are you e... (by Repeater)
Help with piping in c++
 
I am currently trying to make a functional shell within c++ using pipes, forks, and execvp. Currently the forking and execvp functions work, but I am having a b...
[1 reply] : Unix: pipe() https://www.freebsd.org/cgi/man.cgi?query=pipe&apropos=... (by JLBorges)
by sb99
How are these ints uninitialized?
 
So, bear in mind I am a beginner so I am not to worried about the layout as of right now. Everything up until int matchesWon; works fine. However I get the erro...
[4 replies] Last: Ah I found the problem, it was so obvious lol. int points was calling ... (by sb99)
crashed during printing string reference.
 
#include<iostream> #include<string> const std::string& test() { return "sandeep poudel"; } int main() { std::cout << test() << std::endl; /...
[4 replies] Last: std::string const& test() { static std::string name{ "Sandeep Poude... (by mbozzi)
Implement customer unique pointer
 
I am writing unique pointer implementation for Arduino platform. template<typename T> class Pointer { T *t; public: Pointer(T *t) : t(t) {} v...
[1 reply] : Both number1 and number2 have the same problem. They are dangling poin... (by Peter87)
Write an algorithm that takes three integers and returns the smallest integer that is a multiple of all three integers.
 
//author Abdullahjan #include<iostream> using namespace std; int main(){ int i,min,a ; int arr ; for(int i=0; i<3; i++){ cin>>arr ; } m...
[1 reply] : You are being asked to compute the Least Common Multiple. https://www.... (by Duthomhas)
by abc1
Time complexity O(nlogn)
 
Which of the following sorting algorithms yield approximately the same worst-case and average case running time behaviour in O(n log n)? A)Bubble sort and s...
[1 reply] : http://bigocheatsheet.com/ At least (B) is correct, because both heap... (by Ganado)
by helios
Cost of unnecessary virtual inheritance
 
Is there any time or space penalty from inheriting virtually when not needed? For example, consider (x->y means "y inherits from x") A -virtual-> B -> C, where ...
[4 replies] Last: Darn. Thanks. (by helios)
Prevent pointer from modification.
 
How can I prevent a pointer variable from modification. I want to be able to modify and object that is pointed by variable, but pointer cannot be change to po...
[1 reply] : I want to disable ability to change pointer but allow to change the a... (by Ganado)
by Thesar
Overloading of dereferencer and node iterator
 
I am creating a queue, and i have some overloading i need to get working. I start with my two classes: typedef Person Item; class Node; class QIterator { pri...
[3 replies] Last: I got it working woth the <> button, thank you. What it the differenc... (by Thesar)
February 2018 Pages: 1234... 11
  Archived months: [jan2018] [mar2018]

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