General C++ Programming - April 2020

Fibonacci Sequence
 
I recently got a hw assignment to create a program that calculates Fibonacci Sequence using a function. I've had problems with passing paremeters in the past so...
[8 replies] Last: Never mind I figured it out. Thanks for all the help! (by YoungProg19)
Compilation Error in using async with templates
 
I am trying to create a new thread with a recursive function call to the function itself:     std::async(std::launch::async, &CQSort<typename T>::qSort1, arr...
[1 reply] : This compiles and runs. I'm not sure it's entirely correct, though. No... (by dutch)
I need help with this program--creating classes
 
Create a class called Robot (living in a 2-dimensional city of streets and avenues) with the following characteristics: string cityName int ...
[4 replies] Last: Does it follow that if you go far enough South-East there's just a rea... (by helios)
Loop for fraction matrix
 
Hey. How do I build a matrix by rows and columns, and the values must consist of fractions (asks for each numerator and denominator)? There are errors in the co...
[1 reply] : Duplicate post: http://www.cplusplus.com/forum/beginner/270036/ (by George P)
errors
 
I have this question in one of my assignments but I am not sure how to do it. ostream& operator<<(ostream& out, const vec& v) { out << "Vec of size: " <...
[2 replies] Last: You have to cook up the answer, as c++ is not aware of significant dig... (by jonnin)
Out of bounds
 
For this question in an assignment I have float vec::operator (const int i) const { return mem ; } Write a version of this access operator which r...
[3 replies] Last: float vec::operator (const unsigned int i) const //unsigned, unless yo... (by jonnin)
Print out each element from a node in binary tree by using format of output
 
I have a question about a node in a binary tree. I saw some tutorials about this topic on the Internet. But the tutorial is quite simple. So I don't know how to...
[3 replies] Last: 1. Why not just make general, sound and disp contained members of Set... (by doug4)
Can anyone have a look see what might be wrong with my code?
 
My goal is to do a program to predict credit rating using a decision tree. My program should compile as the following: $ make creditrating $ ./creditrati...
[3 replies] Last: Yes. actually refer to files (named train0x, test0x) that contain t... (by Leen0093)
by cdl99
Program reports number of characters to make shape
 
Hello, first time here. I have a program that creates a half pyramid shape using the "*" symbol. The number of rows the pyramid has is determined by the user. C...
[9 replies] Last: Ah yes, you're correct! I got the OP question wrong xD (by malibor)
Character choosing
 
I am having a problem with implementing the choosing of the character with the rest of my code. Instead of being able to choose a character from 1-4 and doing a...
[4 replies] Last: C++ is not Java. In general, don't explicitly call destructors. In g... (by mbozzi)
malloc(): corrupted top size. Aborted (core dumped)
 
I am simply opening a file inside a function. I really have no idea what could cause such a problem #include "encoder.h" void Encoder::Netpbm(unsigned int Ma...
[6 replies] Last: dutch ->Worked like a charm! Also very good suggestions, I will take t... (by urundead)
log N time complexity of a graph
 
( Graph / Union find) Hi guys, I'm studying a course on algorithms, the proposition is prove that any node x's depth is at most log(base 2) N let's take the...
[19 replies] Last: I think N is the size the of the tree. the problem is that they're ... (by dhayden)
"Shortcut" a command
 
I have something like this: class RGBMatrix{ int Matrix ; //STUFF } I want to be able, if possible, to access the RGBMatrix elements like this: RGBM...
[3 replies] Last: Thank you for the quick replays! (by urundead)
Void function reset
 
Is there a way to set up a reset code using void to jump back up in place after a certain line of code is implemented? I was going to use GoTo, however, that is...
[3 replies] Last: "continue" (by TheToaster)
Derived class member function not being called (1,2)
 
So I posted a very similar question previously about this, but a fix that worked at the time has not stopped the same issue resurfacing in a different part of t...
[24 replies] Last: Oh man thank you so much!! I never would have got this otherwise (by zakinithos)
How to display two decimals places in the final result?
 
How do I make the final result display two decimal places? (since I am working with money.) and if there is no decimal I need .00 #include <iostream> #incl...
[1 reply] : Don't double post: http://cplusplus.com/forum/general/269977/ And don... (by Ganado)
HELP!
 
so I was given an input file where they gave me the following information #ofentries fruitname:color, length, width, vitamins\n. I need to run a program that ...
[1 reply] : https://www.cplusplus.com/reference/istream/istream/getline/ to read e... (by salem c)
how to force derived class to implement virtual functions of another class
 
class A { Public: virtual void A1() = 0; virtual void A2() = 0; } class B { public: virtual void B1() = 0; virtual void B2() = 0; } ...
[3 replies] Last: Thanks for the help (by Scarletpimp)
Decrease int value in member function
 
I am trying to build a dungeon crawler type game. I have figured out movement, and damage from attacks and traps. I have a variable 'health' that I initialize t...
[10 replies] Last: @Ganado, it was the Buddha who spoke first about the middle way. (by thmm)
pls urgent
 
3- Write the program that finds whether the number entered on the keyboard is missing or not. (The missing number is the number whose divisors are smaller tha...
[1 reply] : You need a better translator. Try deficient number https://en.wikipe... (by lastchance)
April 2020 Pages: 123... 10
  Archived months: [mar2020] [may2020]

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