General C++ Programming - May 2021 (Page 3)

How to delete pointer objects in a list?
 
Hello again!.. I'm trying to figure out how to delete pointers within a list. With vectors you can do it with a for loop since you can use square brackets . Ho...
[7 replies] Last: I THOUGHT I had typed it was creation sizeable at run-time, but alas... (by deleted account xyzzy)
Guessing game
 
Let us consider a guessing game in which the computer picks a random twodigit number in the range from 0 to 99 and asks the user to guess the number. After each...
[3 replies] Last: Hello faizankhan40, As salem c and the TheIdeasMan say read all ... (by Handy Andy)
by Cplusc
Conjugate gradient using MPI
 
Hello everyone. I've deleted this question because I've posted it twice, sorry for inconvenience in advance.
[7 replies] Last: Why not just put this re-direct: http://www.cplusplus.com/forum/genera... (by againtry)
how can make this code shorter? (1,2)
 
.
[23 replies] Last: The discussions you have on public fora are potentially valuable to ot... (by mbozzi)
by x01337
Data transfering between two programs C++
 
Hi everyone. I just had a question about data transfering between two programs. I currently have a working system but its very insecure. Basically what i do is ...
[3 replies] Last: Thanks so much! :) (by x01337)
Read words
 
Write a program that reads words and arranges them in a paragraph so that all other than the last one are exactly forty characters long. Add spaces between wor...
[4 replies] Last: Read the text one word at a time. If the word can be added to the curr... (by seeplus)
Nestedloops
 
So I have to write a nested loop with asteriks and forward and backslashes. [//Write a program with for nested loops //Faizan Khan //04/24/21 #include <iost...
[3 replies] Last: Hello faizankhan40, PLEASE ALWAYS USE CODE TAGS (the <> formatting ... (by Handy Andy)
How to count up values from a while statement?
 
#include <iostream> using namespace std; int main() { int numberOfItems; int count; //loop counter for the loop int caloriesForItem; int totalC...
[9 replies] Last: The input can fail. Therefore, it should be tested and one has to deci... (by keskiverto)
std::list, object pool, leaks and performance
 
Hello everyone!.. I made a very simple Object pool exmaple using std::list. I think the implementation is fine and I'm almost positive that it doesn't generate...
[10 replies] Last: I was, I suppose, answering how you can use a list (or 'any') containe... (by jonnin)
by Cplusc
Conjugate gradient using MPI
 
Hello everyone. I wrote a C++ MPI code for solving Ax=b equation using conjugate gradient method. Also I solved this equation using serial code in C++. The resu...
[4 replies] Last: If my_rank isn't zero, I don't see any code that would generate any o... (by lastchance)
Variable diagrams
 
Hello all! So I have a question regarding this. It says to draw a series of variable diagrams for the program below , assume that input "2010 t" is given....
[1 reply] : I haven't come across variable diagrams either. However I think that i... (by seeplus)
Solution to having to scroll all the time to find variables
 
After my program has reached a certain size, there are simply too many variables to remember. Especially variables in classes. So I constantly have to scroll ba...
[10 replies] Last: your IDE should assist with this. This. (I presume. Don't use IDE my... (by keskiverto)
Variable initialisation
 
I've come across this C++ 'teaser': How many different ways can you find to define and initialise an int variable (excluding const/static/extern). I've co...
[2 replies] Last: just change the names lol. int32_t word long you can also exploit en... (by jonnin)
Working on Project almost done
 
After a bit of a wake-up call, by a certain jerk, I was able to rework my project c++ code, However, I still need help with the creation of the add range functi...
[5 replies] Last: Without seeing the code you have already, how on earth do you expect u... (by MikeyBoy)
How can I pass a unique pointer as a function parameter?
 
I have a very simple code just to illustrate what's going on: #include <iostream> #include <memory> class Object { public: Object() = default; ...
[3 replies] Last: Ok I understand now!.. I appreciate the help and thanks a lot for the ... (by brianbathorycpp)
C++ function overloading class
 
Can anyone link me to a basic example or show me what this is. I think I get it, It is combining class and using the overload function to make the same class wi...
[2 replies] Last: I see I see. I thought so. Thanks for clearing this up for meh. (by TangentJay)
by CVRIV
Using container modifiers with containers declared with custom classes?
 
I'm... thinking no, but what do I know. I created a vector using a custom class that has it's own public and private data/ members. I wanted to use push_back() ...
[5 replies] Last: It's a good idea to have a data model that separates the object from a... (by againtry)
Comment out a line of code from a compiled .exe?
 
I license a game engine so have to use a compiled exe to run my app. I know about a line of code in the source that is causing a lot of unnecessary compute o...
[5 replies] Last: there really isnt a sane answer to this. Either you need the code, o... (by jonnin)
by parian
wostringstream vs ostringstream
 
Preview not working (again) for me so excuse if this is a mess... I noticed today that the following won't compile: VS doesn't like tconvert.str(""). Says "No...
[4 replies] Last: Fixed the [ stuff. Ummmmm, no, you didn't. Learning to properly use... (by deleted account xyzzy)
Undefined reference to vtable
 
I have to make a Chain of Mountains that contains other chains or simple mountains. For that reason I constructed a Class Mountain and then two sub-class. The s...
[2 replies] Last: Typically the error means that you have declared but not defined the f... (by mbozzi)
May 2021 Pages: 12345
  Archived months: [apr2021] [jun2021]

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