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

TFIDF
Here's a link to the documentation of fprintf https://www.cplusplus.com/reference/cstdio/fprintf/ \t is an escape character that means tab whitespace %d is a sp...
Aug 17, 2021 at 11:57am
[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& ...
Aug 16, 2021 at 8:52am
[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...
Aug 16, 2021 at 8:26am
[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...
Aug 16, 2021 at 1:27am
[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 : https://curl.se/windows/
Aug 14, 2021 at 12:48pm
[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...
Aug 14, 2021 at 12:10pm
[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...
Aug 13, 2021 at 4:28pm
[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...
Aug 13, 2021 at 8:48am
[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...
Aug 12, 2021 at 11:22pm
[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...
Aug 12, 2021 at 2:32pm
[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"...
Aug 11, 2021 at 10:08pm
[3 replies] Last: In the future when posting code a couple of points to read about: PL... (by deleted account xyzzy)
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 <...
Aug 11, 2021 at 5:53pm
[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...
Aug 11, 2021 at 12:11pm
[4 replies] Last: Looks like the local variable does execute close() in the destructor,... (by seeplus)
by Wali23
perfectNumber
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...
Aug 10, 2021 at 2:06pm
[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...
Aug 9, 2021 at 7:30pm
[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...
Aug 9, 2021 at 4:08pm
[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...
Aug 9, 2021 at 10:52am
[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...
Aug 8, 2021 at 10:03am
[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...
Aug 8, 2021 at 12:29am
[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...
Aug 6, 2021 at 6:59pm
[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.
Registered users can post in this forum.