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

C++ Templated struct definition
I have been researching the details of the following struct definition and I have some questions that have been hard to clarify. This came from a source focuse...
Aug 11, 2020 at 12:20pm
[4 replies] Last: where I assumed the 'C' in '<C>' was a placeholder.... I'm not sure ... (by MikeyBoy)
by bibo
Regex error: Parenthesis is not closed.
int main() { string integer = "(\+|-|\0)[0-9]([0-9]{*})"; //string d1 = "("+integer+"."+"([0-9]{*})"+")"; //string d2 = "("+integer+"e"+i...
Aug 9, 2020 at 2:25pm
[5 replies] Last: #include <string> #include <iostream> #include <regex> #include <algo... (by dhayden)
cant get it to read the text files and display the txt help
#include <string> #include <iostream> #include <vector> #include <fstream> using namespace std; class Question { private: string...
Aug 8, 2020 at 12:07pm
[2 replies] Last: cant get it to read the text files and display the txt help Without... (by dhayden)
race condition
Hi! how do I make the following program print numbers in the correct order like this: 0 1 2 ... 100 #include <iostream> #include <thread> int x = 0; void fo...
Aug 8, 2020 at 11:38am
[6 replies] Last: #include <iostream> #include <thread> #include <mutex> int x = 0; st... (by dhayden)
by Ganado
Struct pointer conversion, possible undefined behavior?
I found a place where some weird casting was happening, and I wanted to confirm if someone knew it was legal. // Example program #include <iostream> struct S...
Aug 6, 2020 at 8:44pm
[9 replies] Last: Cubbi: Okay, that's starting to make more sense. I didn't realize the ... (by Ganado)
by plexus
Weighted random distribution
Hi all, I'm trying to generate the numbers 0 .. 9 in a random fashion but with different probabilities for the individual digits. The distribution comes f...
Aug 6, 2020 at 4:09pm
[16 replies] Last: A class based approach to encapsulating <random>/<chrono> is a valid... (by deleted account xyzzy)
Debug C main program
I need assistance in debugging a not-very-large C main program. Reason(s) for the crash are not evident to one who is not a professional programmer. I am using ...
Aug 5, 2020 at 5:27pm
[2 replies] Last: if its small, you can get solid free help here. Can't hurt to throw ... (by jonnin)
by stav
vector of incomplete type UB still?
Hi, i read this article https://www.drdobbs.com/the-standard-librarian-containers-of-inc/184403814 that explains why its undefined behavior to instantiate a STL...
Aug 5, 2020 at 2:48am
[1 reply] : So i think i've found the answer here https://en.cppreference.com/w/cp... (by stav)
by AJS248
Need some help with int/ double input error checkings
I'd like to put a condition for a 'double variable.' For example: cin1: double var1; cin >> var1; (How can I code if var1 is not a number, then execute...
Aug 4, 2020 at 11:58am
[5 replies] Last: #include <iostream> #include <sstream> #include <string> using namesp... (by lastchance)
openssl base64 decode function is not working for specfic string
I have the below openssl code to decode json content, it works fine if the encoded data is "eyJ0ZXN0MSI6eyJ2YWwyIjotOTEuNiwidmFsMyI6NDAuMTIzNH19" but it does n...
Aug 4, 2020 at 4:43am
[6 replies] Last: yes i will pad it with "=" before decoding, Thanks a lot for clarifyin... (by Scarletpimp)
i need some help
During this period of lockdown, many people started to play different games at their homes since they could not go outside. One of the simplest games is Play_W...
Aug 4, 2020 at 1:31am
[15 replies] Last: Not possible, but you can put the screenshot up on Pinterest or some o... (by againtry)
by Puyol
Black and white kings on the chessboard
Inputting the numbers of the white and black king cells on the chessboard in turn, followed by the natural number N and the sequence N consisting of the numbers...
Aug 2, 2020 at 10:56pm
[2 replies] Last: It’s a trick question because the rules of chess are such that the k... (by againtry)
August 2020 Pages: 123
  Archived months: [jul2020] [sep2020]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.