Beginners - May 2019 (Page 4)

by sparki
pixel function C++
 
I have been trying to get the function pixelData() in class background below to work but to no avail. Could someone let me know how to go about implementing it?...
[5 replies] Last: what error? I see nothing wrong there (by jonnin)
by sturk
Unable to get center() function to work properly
 
My center function in class Point below doesn't work as I want it to. In my main, when I reduced 'Point.center().x()' to 'Point.x()', it compiles fine and outpu...
[4 replies] Last: Alright I solved it! Thanks again jonnin for your invaluable explanati... (by sturk)
Getting started with backtracking
 
Hi there! I im interested in learning backtracking properly. Where can I finde some tutorials where they show the algorithm well explained? Im coding with...
[1 reply] : It is shockingly easy, especially if you are using recursion. For exa... (by Duthomhas)
by cs13
Confused with namespaces and templates
 
I am using the DIPlib code obtained from https://github.com/DIPlib/diplib I have a simple program using code from it: #include <iostream> #include "diplib.h...
[9 replies] Last: This took me about 2 minutes to pin down on the site. First, the retu... (by Niccolo)
Expeceted ; when I have one
 
Hi Sorry I this may seem like a stupid question but I am a beginner in C++, I really don't knonw where this error is coming from because at the previous line o...
[10 replies] Last: [quote=man gcc]-E Stop after the preprocessing stage; do not run the ... (by ne555)
by vysero
Trying to understand this line of code
 
I have this line of code here: m_delayOn( new GallatinCore::SettingValue( DelayOnStr, CommonJobData::DELAY_DEFAULT, CommonJobData::DELAY_DEFAULT, CommonJ...
[3 replies] Last: never mind I figure out how to do this in a different way thanks guys! (by vysero)
Do I use dynamic memory correctly ?
 
Hello, I'm a new dynamic memory allocator :) I'm working on projects for microcontrollers like Arduino, so I want to reduce memory usage of my code, as much a...
[9 replies] Last: Ok, thank you all for answers, especially Niccolo :) I'm still not su... (by GodIsDead)
Cookie PickUp Inheritance Game
 
I'm writing a code for class that is an inheritance pick up game, we were tasked to limit the player to the play area, so not allowing them to move outside of t...
[2 replies] Last: - CookieCollect::SetupScreen() should call PickupGame::SetupScreen() -... (by dhayden)
Whitespace question
 
I've been working on a banking system where you have a few options of what you can do. I'm not that far in, but I'm in need of help when it comes to whitespaces...
[5 replies] Last: A stream is a stream, whether it is std::cin or a file. If you need... (by George P)
by kitfox
Do I need to worry about allocating lots of tiny arrays?
 
I'm writing a program that needs to keep track of user defined attributes. I have a class that describes the details of the attribute, along with a pointer to ...
[12 replies] Last: A gigabyte is really REALLY big. Heck a megabyte is pretty big. As a... (by dhayden)
Ranked Choice Voting
 
I'm currently writing a program where it performs a series of ranked choice elections based on an input text file containing 3 sets of 5 ballots of the voters' ...
[5 replies] Last: I realized the rounds were optional If the rounds are optional then ... (by dhayden)
by aligh
Why the cryptic style?
 
This is the behavior of the STL unique_copy function, according to cplusplus.com: template <class InputIterator, class OutputIterator> OutputIterator uniqu...
[3 replies] Last: Ahh, thank you! Now, I see! (by aligh)
by sturk
C++ operator test failed
 
I have been thinking for a while now why doesn't my operators work properly when I get to the condition if (v4 * v5 == x1 * x2 + y1 * y2) in my main. But just c...
[1 reply] : @playpro, One has to to do rather a lot to get your code to compile: i... (by lastchance)
Stuck on a 0.
 
So, I'm kinda new to this and i took an extra course in my school to learn programming. Got this task and i tried to write a program to count it, but it keeps t...
[18 replies] Last: Naming aside, the thinking in these: OP: the "n" is how much more has... (by keskiverto)
by sturk
C++ overloading operator
 
I can't seem to get the correct output when overloading the *operator to find the dot product. Would appreciate if anyone could help. Correct output: 38.45 My...
[3 replies] Last: Thanks guys:) (by sturk)
Dynamically allocate 2D array
 
Hello, I'm trying to dynamically allocate 2D array. I have this function: int **read_matrix(FILE *in, int *count) { int **matrix = NULL; char *l...
[5 replies] Last: In your second realloc, you are assuming that matrix[i-1] will be NULL... (by dutch)
Remove ellipse from canvas
 
I am trying to draw ellipses on a canvas on left mouseclick, which must be removed on right mouseclick. Below is the essence of my code. This code is removing t...
[4 replies] Last: Yes, that looks fine. Make sure you properly find the object in your l... (by Duthomhas)
Algorithmic notations
 
Hey guys, So my question may sound strange but it isn't a question about algorithm time complexity such as big O notation, my question is about the notati...
[7 replies] Last: +1 on signing up for a class on design and analysis of algorithms. You... (by Duthomhas)
by tixer
Program that reads text from file and outputs each line to the screen from another file
 
I am failing to copy the file to another file preceded by Number line #include <fstream> #include <iostream> #include <cstdlib> #include <iomanip> using ...
[3 replies] Last: ok. now put it in code tags <> on the side bar editor, and explain wh... (by jonnin)
by jxr006
Heartbeat per second, losses time on computation
 
Hey folks, I have a business case where i want to post a heart beat per second. The problem is the code run slow is down by a few miliseconds that over time, it...
[6 replies] Last: I'm sure sleep_for() just uses Sleep() (or whatever underlying functio... (by helios)
May 2019 Pages: 123456... 16
  Archived months: [apr2019] [jun2019]

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