General C++ Programming - March 2021 (Page 4)

i need help on my assignment
 
i cant figure this assignment can someone help? 22. Create a program that calculates the average weight of 15 fruit (mandarins) when the weight of each fr...
[2 replies] Last: What part are you having difficulty with? Do you know how to calculate... (by seeplus)
by VoB
Marking a function as const: what does the compiler do?
 
Hi everyone, I'm trying to understand what happens when a function is marked as const in a class. Consider the following simple class, where a function foo is u...
[3 replies] Last: const int* a means that "a is a pointer to a constant integer"? Co... (by Ganado)
Incorrect result
 
I check time of foo(). It I make a graph of the dependence of the average value on n I should get a parabola. But now I have this result. Avarage grows up but ...
[9 replies] Last: > Ask yourself: Can something else running in the same machine at the... (by onetwo123)
Packing exe + dlls into one executable
 
Hello everyone, please any way to Packing exe + dlls into one executable? i use Dev-c ++
[5 replies] Last: I'll give a reply, but I don't have very good news. There is no standa... (by Ganado)
Curving the Grade
 
Write a program to help determine a grade curve. The program reads all the student scores, determines the highest score, and then assigns grades based on the f...
[8 replies] Last: only available with -std=c++11 It's 2021. Time to upgrade your comp... (by lastchance)
by moctar
divisibility of a Binary number
 
is there any ways to check binary divisibility without using modulo like (p%5==0) but rather using decrease and conquer algorithm. i already now that to chec...
[1 reply] : Don't cross post https://www.cplusplus.com/forum/beginner/276805/ (by salem c)
Incorrect result (arrays)
 
There are 3 methods. measureTime() works correctly. But meanTime() and stdTime() give me something like -3.13558e+67. How can I fix it? statistics.cpp #i...
[1 reply] : - get rid of global `means'. - get rid of all your input/output opera... (by ne555)
Last node in linked list not sorted
 
This works perfectly except the book that's supposed to go first (i.e. a book that starts with 'A') is at the end of the list. void inventory::insert_sor...
[1 reply] : One issue is that you are swapping just the name of the book, not the ... (by Ganado)
by moctar
strassen based matrix inverse
 
i am trying to write a program to get the inverse of any type of square matrix using strassen based matrix inversion. but what i don't understand is how to rep...
[1 reply] : [Duplicated here http://www.cplusplus.com/forum/beginner/276798/ ] (by seeplus)
Friend function and fraction
 
have an assignment that requires alot of use with classes, the idea of the code is to manipulate fractions to find greatest common denominator (GCD) and other t...
[1 reply] : [Also duplicated here http://www.cplusplus.com/forum/beginner/276793/ ... (by seeplus)
Palindrome
 
Is there a way to determine if an integer is a palindrome in C++?
[3 replies] Last: You can always convert an integer into string and check that. (by keskiverto)
by brim4
How can I use typedef and auto to clean up my unique_ptr<vector> declaration throughout my projects classes?
 
Hello, I'm new to c++ so any help will be appreciated. When I'm making a weapons declaration it's quite cumbersome and long. It would be nice to be able to t...
[5 replies] Last: Thanks, guys. I'll close this now. I realised that I had to place it b... (by brim4)
Reordering array elements
 
Hi, I am a rookie when it comes to C++ and would appreciate your insight, so I can go up on the learning curve. I am trying to write a function that reorders...
[9 replies] Last: Thank you all for your help and advice. Learning is a process and it ... (by learning123)
overloaded set of lambdas not working when using variadic template classes
 
Hi, The idea is to be able to create an object with several operator() taken from lambda expressions in order to overload it. The idea works fine when we ha...
[4 replies] Last: @mbozzi your code does not compile for me in Visual Studio 19 v16.9.1... (by mbozzi)
by JRManx
Weird template return value
 
I am trying to make a function template that takes a "vector<T> v" as the parameter, and returns the total of all values in "v". It is supposed to be able to a...
[8 replies] Last: Yeah, I bet most of us have done that (or something similar) at one ti... (by JRManx)
by frek
Printing std::map contents differently
 
The exercise (8 of chapter 21 of the book PPP) says: Take the word-frequency example from ยง21.6.1 and modify it to output its lines in order of frequency (ra...
[6 replies] Last: I'm not exactly sure what you mean, but the operator for std::map is ... (by Ganado)
calling non-template version
 
Hello all, I am having problem causing non-template function to be called. I want the minD with two parameters to be called for integer values and I want no...
[12 replies] Last: Thank you so much for your time. I appreciate it. (by Passionate programmer)
Dice c++
 
Hello! I have a c++ assignment, im supposed to make a program that will throw 6 dices then find out the total sum and find and point out the highest and lowest ...
[1 reply] : Are you supposed to be using arrays for this assignment? I see you hav... (by Ganado)
by dean
Reserve space in the stack for an unitialised object
 
Hi folks, what's the best way to reserve some space in the stack for a uninitialised object. For example: uint8_t* data = m_prefix; MyUnitialisedObject _obj...
[8 replies] Last: @doug4 ah right =) @seeplus due to optimisation reasons, already prof... (by dean)
Locker Game
 
Imagine a high school hallway with n lockers and n students. Now imagine a single student walking down the hallway and opening or closing the lockers. That's ...
[18 replies] Last: what does vector<bool>& mean? I am confused why it has to be a vector... (by doug4)
March 2021 Pages: 1234567
  Archived months: [feb2021] [apr2021]

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