General C++ Programming - August 2021

by Cplusc
preconditioned conjugate gradient solver
Hello everyone. I wrote a simple diagonal preconditioned conjugate gradient solver and I followed the steps provided below. #include <iostream> #include <ioma...
[4 replies] Last: @lastchance I fixed the code. I modified the code in this thread. Than... (by Cplusc)
c++ saved input
I'm having trouble with my no_mana function i want i to stop the player from enetering the skill menu becuase he is out of mana. Even tho it does what i wanted ...
[11 replies] Last: the function of ItemMenu does not have branch to deal, when you intp... (by xtan)
Errors while calling class from other file
#pragma once #include <iostream> #include <stdlib.h> #include "BattleMenu.h" using namespace std; class MenuTransition{ public: int user_input; void t...
[8 replies] Last: I'm running it normally without line 14 in the MenuTransition. And i'm... (by DumbGuy)
How much C++20 features will speed up the compilation time in practice?
I've searched pretty much everywhere but I can't find a single source that has benchmarks about the compilation times with the new C++20 features like "Modules"...
[2 replies] Last: Huh. Why would it hurt build parallelism to use modules? (by helios)
XOR encrypted string - decryption problem
Hey, I have an problem with decrypting XOR encrypted string (every char is encrypted and appended to string). I have an "key", what original string was and the ...
[6 replies] Last: what is key? is "AES" your test case? a quick google tells me that... (by jonnin)
Lambda capture copying requires mutable declaration (1,2)
I'm not really understanding why the foo() lambda requires being declared as mutable in the following bit of code: #include <iostream> int main() { int...
[22 replies] Last: As long as you didn't do anything illegal or highly immoral I didn't s... (by George P)
by Setat
sum of nodes in a tree.
Hello,I have a tree with "x" in the root. How can I print the sum of these node? Is it possible to implement it with a recursive function? print these 16 s...
[9 replies] Last: Yes, it's not a complete tree, just a part of it. I agree, Keskiverto'... (by Setat)
Problem with free() and virtual memory
Hello everybody, I am working with the malloc(), calloc() and free() functions and I am having a little problem. If I execute the code below the memory seems to...
[8 replies] Last: new, delete, new , delete : manual memory management the C++ way. The... (by George P)
What's Missing?
Having issues with the code below. Everything is working fine except the adding function of sum += weight. The program adds/subtracts the last number entered by...
[12 replies] Last: I think the use of comma operator is ugly as heck. (by Ganado)
Serialize signed values
I am trying to serialize data using a stringstream. I ran the following test, and it failed at CHECK_EQUAL(result6, check6); What am I missing here? TEST(Ser...
[5 replies] Last: This link looks really good. Thank you very much. :-) (by Jakob Clausen)
Abstract Class Question (no code)
1.) In my Abstract base class I have an array called seats . 2.) I have two types of seats, the floor and the balcony derived classes. 3.)If I create an objec...
[7 replies] Last: I thought if I made it protected in the base Abstract class "Theater"... (by doug4)
by sm9
OpenMP parallelisation - how to make variables that last through the lifetime for each thread
Hi all, I am trying to parallelise a for loop in C++ with openmp. In each loop a vector is populated with values from various calculations. std::vector<doub...
[5 replies] Last: @mbozzi Thank you, I also found threadprivate while searching for it, ... (by sm9)
C++ Recursive function "asterisks"
How do I get an output something like this? Ex. Input: 5 Output: * * * * * * * * * * * * * * * Here is my code. </code> #include <iostream> us...
[5 replies] Last: I don't doubt the assignment is to use recursion, but I was bored and ... (by George P)
by mot
need help for this problem
1. Create an array of integers and initialize/assign random values to each element. 2. Allow the user to input an integer. 3. If the user input is present insid...
[5 replies] Last: @mot, If you change your lines for ( i = 0; i < array_size; i++) { ... (by lastchance)
Type "ArrayList" could not be resolved in eclipse
I have the following code with a header, a CPP code, and a driver code. Here is the header code: #ifndef HUMAN_H_ #define HUMAN_H_ #include <iostream> #inclu...
[4 replies] Last: I just found out that I just don't have the Array header file in my Ec... (by anonymoususer13579)
c++ call class from on file to another
I'm trying to call my class CharacterMenu from my other file so i can start it after the user inputs 0 to start the game. But i'm getting an "error C2360: initi...
[11 replies] Last: Outside of the scoping issue mentioned by Grey Wolf , there is really... (by Duthomhas)
examples for >>
Oh, yeah, I remember why I lost the will to help people. They post a question, get help, then go out of their way to delete their questions . Good job, mike...
[14 replies] Last: [quote=MikeyBoy]What am I supposed to have done now? Heh.™ (by George P)
is it possible to use function pointer like this?
---sorry for my bad english--- i want to use like this (DWORD(__stdcall*)(DWORD))0x12345678(10); and i don't want to use like this DWORD(__stdcall* funct...
[1 reply] : You just need another pair of parentheses: ((DWORD(__stdcall*)(DWORD... (by coder777)
by Kmpck
Question about pointer objects
Question about pointer objects Hi guys! I am trying to study and understand something… Take this line…. struct dirent *ent; That lines re...
[3 replies] Last: struct foo { things } variable; //this makes a variable of type fo... (by jonnin)
function within a function error
Hi, working with trying to get a function within a function to work. I get the following result: Error C3861 'printLines': identifier not found void functi...
[2 replies] Last: That did it, thx. (by technologist)
August 2021 Pages: 1234
  Archived months: [jul2021] [sep2021]

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