General C++ Programming - January 2020 (Page 6)

identifying parameters
 
are there any parameters in this program (i dont think there are bc it is int main())? if not, how can I add them to the program? #include <iostream> #incl...
[2 replies] Last: #include <iostream> #include <iomanip> using namespace std; int m... (by againtry)
Validate input parameters before pass to the function or in function body?
 
Hi All, Validate input parameters before pass to the function or in function body? e.g. in bellow example which is the best practice CASE 1 or CASE 2? ...
[4 replies] Last: I agree with the above. Typically I have a small handful of extremel... (by jonnin)
Hello Guys! (1,2)
 
Im currently practicing coding hmmmm.. i dont know what went wrong here im just practicing using youtube. wondering if anyone can help me on this? self study ...
[22 replies] Last: :( not (by againtry)
Area of a rectangle
 
Hi. I am trying to calculate the area of a rectangle with x and y vertices. The program should finish either if the second vertices x is on the left side of the...
[11 replies] Last: Just solved the problem:) Thanks for your help #include <iostream> usi... (by yabi2943993)
searching a vector of objects (1,2)
 
hello devs i have a vector which was populated with information from a text file, //text file 10101 Mike Sanderson 10202 Bart Simpson 10105 Lisa Simp...
[25 replies] Last: @lastchance thank you very much you're a lifesaver xd, it is now worki... (by blendero777)
let c++ have static_assert without interruption
 
how can we make c++ have static_assert without interruption or disruption, simply instead skipping it let's realize this illustration: #include <cstdi...
[5 replies] Last: I imagine (a variation on) the pattern @JLBorges demonstrates will be ... (by mbozzi)
by koce
template class template parameters
 
Hi guys! I am experimenting with a template Binary_Heap class, initially like this: template <class T> bool comp_min(const T& left, const T& right) { return...
[5 replies] Last: Awesome, thanks, man! (by koce)
affine texture mapper problem
 
I am trying to write an affine texture mapper for my software renderer and it seems to work but not as I excpected, this is what I get after drawing a triangle ...
[1 reply] : ¿how are you computing 'u' and 'v'? the band fighting may be a precis... (by ne555)
by volang
Pointers within the same range/memory block
 
In some cases, after incrementing pointers I want to make sure that the pointer is still within its range How can I check that a pointer/value exists inside t...
[7 replies] Last: you should always know how big a pointer is. If you allocated it, you... (by jonnin)
by volang
Char pointers assign
 
Hello, hope you all are doing well! How do I make "a" ("a" is inside another function) equal to "c"? (I cant use a return value for this) char * a; myfun...
[7 replies] Last: I tried std::string for images/videos, which didnt work String is de... (by dhayden)
by aster
avoid use of malloc/free on a function
 
Hello, A few month ago i made a function (thanks to the help of the forum) that take a char string and split it into a 2D array of char strings. Now i would li...
[5 replies] Last: Since you don't manually allocate memory, yes. However just being mem... (by jlb)
by aster
function works if called once, memory leak if i call it again
 
EDIT: my bad the problem was not inside the function Hello, a few months ago i wrote here for help and some experienced users helped me with a pointer-hea...
[5 replies] Last: Well, ok, I feel embarrassed for this. This line in ArrOfArrs::double... (by Enoizat)
by H00G0
Error trying to pass function as argument
 
Hello! I'm having a problem passing a function as an argument, to another function. Consider the following class: class Foo { public: void displa...
[10 replies] Last: You can't have it both ways. If the function interacts with a (non-st... (by H00G0)
I am trying to create a following code with the information below.
 
How would this be written with the following information: Create a Person class. This class has the following private members: char name ; char lastna...
[3 replies] Last: #include <iostream> #include <string.h> using namespace std; class ... (by shanno8)
Kaprekar constant
 
Hi, I am trying to make a program, which calculates how much steps are necessary to get to the Kaprekar constant of a 4 digit number. (Kaprekar constant: By ord...
[3 replies] Last: FIrstly, learn to use code tags to post code! You probably just need ... (by dutch)
by ruzip
Deleting and Freeing an Array of Structs/Objects from Memory
 
How do I free and delete an array of structs/objects from memory? I tried free and delete , but the values are still there. I particularly require this C se...
[16 replies] Last: Yes, I got it now that is why I decided to just to delete and reset th... (by ruzip)
by Ganado
Nice
 
Edit your post and add [co de] and [/ code] around your code and output to format it. https://i.kym-cdn.com/photos/images/original/000/450/154/820.jpeg...
[3 replies] Last: I'm glad he/she got the answer they wanted. It's over to the teacher ... (by againtry)
Output problem
 
Hi, I have the following code: #include <iostream> using namespace std; int main() { int num; string out; do{ cin>>num; ...
[5 replies] Last: Ok, thanks lastchance (by yabi2943993)
Output problem
 
I have a program which takes an input for a case, then makes the output and if the input is 0 it stops running. I want the program to output all results at the ...
[5 replies] Last: Thanks to all for your help. For those who asked, why I want to do suc... (by yabi2943993)
Factory can't access friend's constructor
 
I have a factory: class FordFactory : public ICarFactory { public: FordFactory() { } ~FordFactory() { } std::unique_ptr<Car> assemble() override...
[8 replies] Last: > It's make_unique that seems to have trouble accessing the protected ... (by JLBorges)
January 2020 Pages: 1... 456789
  Archived months: [dec2019] [feb2020]

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