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

Here's a link to the documentation of fprintf \t is an escape character that means tab whitespace %d is a sp...
[8 replies] Last: to compare a sentence of the user to a text contained in a text file ... (by seeplus)
by Cplusc
preconditioned conjugate gradient solver
I wrote a preconditioned conjugate gradient solver but when calling the function it just gives me zero. any help would be appreciated. int PCG(SparseMatrix& ...
[5 replies] Last: Your code will only ever do one iteration, and it won't change sol() o... (by lastchance)
Reading values from a json file and storing them
I just got started with jsoncpp in my game and I'm using it to store settings and to save the game and I've been able to write to a file, but I haven't been abl...
[2 replies] Last: Did you check if file is open ? std::fstream has "is_open()" function ... (by kbz8)
Fwrite stored file and its data from another file archive issue
Hello, I am trying to write a file, and it's file size from an archive file .afs. This file "0611_bgm.adx" is stored inside this .afs file and I need to w...
[16 replies] Last: opcodes means: in an executable file (.exe, .dll, .scr, things like th... (by jonnin)
problem in curl .
How install curl in codeblocks Dawnload Link :
[17 replies] Last: thmm Thanks for reply. Okay i'll try another lib, Thanks so much , (by Hawlong)
Help me with these conceptual algorithm questions please
A. Given a graph and assume we computed the minimum weight paths using Dijkstra's algorithm (we maintain a predecessor array), if we add a constant C to all edg...
[6 replies] Last: Low hanging fruits: I is not detailed enough. Its technically fals... (by jonnin)
HBITMAP outside or CreateCompatibleBitmap inside?
I am using C++11 and Code::Blocks 17.12 and compiling on a 32 bit system. NO Visual Studio. NO .net. I plan to compile this later on a 64 bit system. I have two...
[2 replies] Last: salem c Thank you. Got my answer. Got a short, understandable, dire... (by keyboard9)
how to convert HANDLE hProcess to Hwnd
how to convert HANDLE hProcess to Hwnd , I want use it in this function SetForegroundWindow(); void killProcess(const char *filename) { HANDLE hSnapSh...
[16 replies] Last: malibor working thanks so much , Ganado thanks for help <3 , seepl... (by Hawlong)
Default template arguments
My understanding is default template arguments must be followed by default template arguments, should be not legal, but it compiles jut fine with msvc: templa...
[2 replies] Last: Ah OK, I misread that part, this answers the abbreviated version as we... (by malibor)
Why some people use "this->" when there is no need? (1,2,3)
I see some repositories explicitly make use of this->whatever(); for almost every function call within class. But just saying whatever(); is enough because...
[42 replies] Last: regarding comments going out of date because functions grow... It's w... (by malibor)
Why g++ didn't choose move constructor
For this program source code: #include <cstdio> #include <utility> namespace { int ID; struct T { T(): id(++ID) { printf("construct %d\n"...
[3 replies] Last: In the future when posting code a couple of points to read about: PL... (by George P)
for loop gives the same result
I try to generate randlomly sequenced po, p1, p2, p3(three of them are 0 and the other is 1)But the for loop gives 4 same sequence. Can you help? #include <...
[4 replies] Last: Hello grkanklcsln, My apologies. In my hast to head the call of natur... (by Handy Andy)
ofstream doesn't work as a class member
I am trying to make my own file handler, but as always when i try to use std, there are problems. The exactly same code does work when the ofstream is local, bu...
[4 replies] Last: Looks like the local variable does execute close() in the destructor,... (by seeplus)
by Wali23
Can't figure out level-2 to level-4>>> Level 1: Small perfect numbers Begin by writing a program that prints perfect numbers (those with a badness of 0). Separ...
[4 replies] Last: #include <iostream> #include <cmath> #include <cstring> using namespa... (by lastchance)
Randomly generated gaussion distribution array
Hi guys, I am trying to create an array which inludes random gaussion distribution elements with mean = 0, standard deviation = 1 and size= 20. The correspon...
[3 replies] Last: Thanks a lot guys. You save me a lot of trouble. (by grkanklcsln)
Returning more than one value from a function
I want to return multiple values (p0, p1, p2, p3) rather than one. Thank you in advance. int probabilities(int newstate) { int p0, p1, p2, p3; float max...
[8 replies] Last: It's probably Q-learning anyway, in which case I thought the idea was ... (by lastchance)
Ray - Sphere Intersection
Can someone help me get the Ray - Sphere Intersections formula using quadratics? It's for my homework and I'm having problems finding the answers. This is t...
[14 replies] Last: My bad. I thought dot() and the others were part of struct Pt. Doh! (by dhayden)
by gander
smoothen vector<string_view>
I've split my string into vector<string_view> and now I'd like to get back the original string (or a list of substrings if elements were deleted). my question i...
[14 replies] Last: hope you're aware that when giving split() the parameter "false" the... (by seeplus)
How to print a Html file with c++
Hello my name is alex and I'm from France so sorry for possible mistakes. I developed a programm in c++ for a gite de france in order to create contracts eve...
[15 replies] Last: I think the better question here is how OP's employer feels about us... (by Duthomhas)
by Cplusc
scatterv in dot product
I am trying to do a dot product of two vector using mpi. the size of vector is not dividable by the number of processors. let's say the number of element in the...
[7 replies] Last: @lastchance Thanks for this point, "More seriously, when you tried usi... (by Cplusc)
August 2021 Pages: 1234
  Archived months: [jul2021] [sep2021]

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