General C++ Programming - July 2021 (Page 2)

Valgrind: segmentation fault error (1,2)
 
I have a serial code that is working perfectly and printing out data as expecxted. I rewrote a parallel version using openMP of it while testing individual for ...
[29 replies] Last: No worries. Sorry for making you deal with my broken code. (by helios)
by helios
Forward compatibility with abstract classes
 
I just read something that I'm pretty sure is incorrect, but I wanted to make a sanity check. Suppose you have an abstract class Base that defines an interfa...
[5 replies] Last: Example with four translation units: class Base { virtual int meth... (by keskiverto)
unclear variadic template recursion
 
Hi, which of the 2 codes is correct: template<class Opt> constexpr bool has() const { return tuple_helper::tuple_contains_type<Opt, c...
[8 replies] Last: Okay, thank you for the explanation. (by coder777)
by Cplusc
calling methods from another class
 
I have two classes Node and element and I made a vector of each class's objects; class Node { public: VecDbl_t* Coordinates_; Node() = default; Node(VecDb...
[16 replies] Last: I do appreciate your explanations.it was helpful. (by Cplusc)
Some hard questions (maybe?)
 
Hi guys! I'm new to this forum and community. Wanted to take a second to introduce myself here. I'm a software developer specializing in web development. Most o...
[4 replies] Last: I suggest making a test WAV file that just makes a constant, pure fre... (by Arcalise08)
Need slight help with adding two more code words for user to guess
 
Hey y'all, the basis of my program is similar to hangman. I want to display 3 code words out of the 10 that I have for the user to guess. As you can probably se...
[5 replies] Last: As a simplified and updated version, perhaps consider: #include <io... (by seeplus)
Assign array to magic hexagon
 
Hello to everyone; x y z a b c d e f g h i J k l m n o p The following code assigns and lists the numbers 1 to 19 with all rows and ...
[5 replies] Last: your code also runs fast but still listed from 1 to 19 my c++ knowled... (by anticode)
I'm learning using string in if statement. but somehow i dont know how to make this to work.
 
#include <iostream> #include<string> using namespace std; int main() { int i; cin>>i; string s1; if(i==1) { string s1 = "Hello"; } ...
[5 replies] Last: // <--- The "cin" ALWAYS needs a prompt. Hmm. If the program is d... (by seeplus)
detecting a full mouse click all at once
 
Ok, so I am trying to detect a mouse-click, and am stuck detecting both a mouse down and then a mouse up to constitute a 'click'. This can get tricky if you wan...
[3 replies] Last: This module works: if (GetAsyncKeyState(VK_LBUTTON)<0) { ... (by technologist)
by nikee
Two outputs instead of one (1,2)
 
I made a C++ program(link here: https://replit.com/@nikegamerjjjj/NikPoloTerminal?v=1). I have a problem. You can see in link code, so when you are there, my ...
[23 replies] Last: Also, instead of using >> to obtain username/password, consider using ... (by seeplus)
Is encapsulation necessary in solo projects?
 
I am currently programming a game solo. I have an Object class that has a craftingMenu() member, in which I use public attributes (miscItems and blueprints) fro...
[11 replies] Last: So: No I don't see any use for getter and setter. Just for getter. ... (by jonnin)
I was on working something and && is not working properly
 
For my assignment I have to take sets of 3 integers separated by spaces from the user input and determine whether or not they can form a triangle, and if so whe...
[6 replies] Last: Thanks JLBorges for the correction. :) (by dhayden)
by Cplusc
Sending vector of objects in c++ mpi
 
Let say I have a class named Node which makes the Node with x and y coordinate. Then I make a vector of objects from set of Node. now I want to send this vector...
[6 replies] Last: Thanks (by Cplusc)
by eak006
Linked List of Shared Pointers Causes Unknown Infinite Loop
 
Hey guys, I tackled LeetCode problem #82 - Remove Duplicates From Sorted List II: - https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ ...
[6 replies] Last: Perhaps I should define a destructor for ListNode class that destroys... (by helios)
by kenpry
Struggle with finishing project
 
So, Im supposed to define the member functions of the class that I created in another .cpp file. I already have the header (.h) file but when I go to build the ...
[1 reply] : See https://www.cplusplus.com/articles/Gw6AC542/ (by keskiverto)
by dune
Furthering a CPlusPlus Exercise
 
I found these exercises through a search: https://www.cplusplus.com/forum/articles/12974/ I'm down to the Bracketing Search exercise and have coded the bot to ...
[4 replies] Last: Got it covered in Line 22. But I did change Line 15 int range = max... (by dune)
send file using winsock c++
 
I am trying to send a text file from client to server and server should return that text file back to client after reading and updating the contents of the file...
[4 replies] Last: I don't quite understand this shunting some file backwards and forward... (by kbw)
by Cplusc
MPI Printing result
 
I have a vector of vector and I sent it to all processors. for example main() { if (...
[6 replies] Last: Sending to ALL processors. Note that, despite the MPI_Barrier call, yo... (by lastchance)
Everything is an object...
 
I have been working on my own project for a while, it's an OOP framework around SDL2. I've been following a shallow depth form of "everything is an object". I h...
[12 replies] Last: If you need to update a specific member on all objects Thank you fo... (by jonnin)
Ray - Sphere Intersection
 
I have an Assignment due next week, and I need help starting it. I am kind of clueless as to where to begin if anyone can help. File: https://drive.google.c...
[12 replies] Last: Tutorial: https://www.weizmann.ac.il/sci-tea/benari/sites/sci-tea.bena... (by JLBorges)
July 2021 Pages: 12345
  Archived months: [jun2021] [aug2021]

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