General C++ Programming - January 2022

what concept should I write in C++20 to make sure a template parameter is the instantiation of a template class C
 
Hi, I have this code: template <typename T, typename ...RefBy> requires (???)) struct TableDef { }; I need T to be TableKey<U, int U::*K> fo...
[no replies]
Double Linked List, Swaping Nodes
 
Edit: Another shitty "post, delete and run away" drive-by pissed on the forum and made a meaningless set of replies. > //Swap base temps > nodeA_n ...
[1 reply] : Writing some code as debugging scaffold would help. Use it to dump in... (by JLBorges)
by RoboDo
Execute List of Arbitrary Methods from Arbitrary Objects
 
Hello, I wish to implement a list of pointers which point to methods from a diverse collection of objects and then execute them in order. To give some backg...
[10 replies] Last: > is there isn't a way to store or pass a member function pointer gene... (by JLBorges)
by frek
C++ basic multithreading
 
Hi all, In this following piece of code: #include <iostream> #include <thread> static bool finished = false; void doWork(int n) { using namespace std:...
[10 replies] Last: > Do translation units use storage areas (apart from their static vari... (by JLBorges)
Currency Conversion Calculator
 
I'm halfway into my assignment and I'm not sure what else to do, how to finish the assignment. I'm currently quarantined at home and don't have anyone to ask fo...
[no replies]
by atiger
split vector and store words
 
I am trying to read a text file and then store each line into a vector then split that vector and isolate each word to another vector. basically, I want to read...
[2 replies] Last: The main issue is what constitutes a 'word'. Is dog the same as Dog t... (by seeplus)
some struct problem
 
Currently, I am working on an assignment. but I encounter a problem of returning the value of longest.start longest.length. The main part must not be changed. I...
[5 replies] Last: ok i will try, thanks! (by pokemon629)
math & printif
 
Hi im trying to calculate and show this equation y(x)= 3*x2+3*x-1 for following x the formula x = a+i*h where i=0,1,2, ..., N. data: a - starting point x, h ...
[8 replies] Last: As an aside, I ran into an math expression evaluator library: https://... (by kbw)
Math: how rotate a 3D point? (1,2)
 
from these image i did a rotation function: https://imgur.com/mNWt6GR struct point { float x,y,z; } ; struct angle { float x,y,z; } ; p...
[37 replies] Last: i need understand, on rotation or perspective: why i get several whole... (by Cambalinho)
Power & sigma
 
hi I'm trying to figure out how to make this to work basically user need to enter numer (top of sigma) and the program should calculate the result the formu...
[5 replies] Last: Many of these summations have a direct equation that gives the answer ... (by jonnin)
by frek
Getting started learning C++ network programming
 
Hi all, I like to learn network programming but know almost nothing about it except for a few general terms like IP, TCP, IDP, pocket and so forth (all coming ...
[2 replies] Last: There's several books available on Asio C++ programming. Just search A... (by seeplus)
better code with cout
 
I am calling a SELECT from Mysql and the row is having three fields. Just for test, the third field has some NULL values. As soon as cout sees a NULL, it quit...
[1 reply] : The first thing would be to show decently formatted code. If you want ... (by salem c)
by thugsy
How do I safely make a thread with a loop that awaits input?
 
Hey there, im making my first c++ based fullstack app and I have a problem where I need to wait for the player to hit enter asynchronously The way I have it s...
[1 reply] : #include <iostream> #include <thread> #include <functional> #include ... (by JLBorges)
Build a tree
 
Implement a complete tree—one that is completely full except possibly on the right end of the bottom row. Each element should be inserted from top to down and...
[1 reply] : That's called a self balancing tree . Look up the algorithm and get ... (by kbw)
Manipulating a String by Reversing the Word Order Help
 
Hello. Can someone help me with this problem below? I'm currently studying how to manipulate a string by myself and can someone on how to reverse the order of t...
[3 replies] Last: Reversing the word order is just one step more: find where the words... (by Duthomhas)
coin smallest
 
I am trying to find the amount here. Input The first line of input contains an integer M, the number of coins in bank. The second line of input contains M int...
[14 replies] Last: I was checking with some random test case here, but it seems there is ... (by leo2008)
by isv
How to pause and unpause my console on the desired key
 
I want to pause my program on the 0x32, 0x33 and 0x34 key and make it work again on the 0x31 key, how can I? I used this code to pause on the 0x32 key, it's wor...
[1 reply] : you can't stop the program AND also have it respond to input. howeve... (by jonnin)
Simplifying Radicals Program (1,2)
 
hello, I have a homework question which is to create a program that lets the user enter the degree of the radical and the value under the root and write the rad...
[20 replies] Last: ... and the 'moral of the story' is of course to get your algorithm de... (by seeplus)
Reading numbers from a date
 
So I am given a date of "June 10, 1960". My job is to write a program that takes "6/10/60" as the user input all on one line. I am told I need to use the extrac...
[4 replies] Last: For entering time/date, there's also std::get_time manipulator where t... (by seeplus)
by RicoJ
Why does std::declval<int&>() returns lvalue reference?
 
Below the return value is “is lvalue”. However, in the documentation, (https://www.cplusplus.com/reference/utility/declval/), it seems that we always get rv...
[4 replies] Last: Scott Myers has a whole section on reference collapsing in his book "E... (by seeplus)
January 2022 Pages: 1234
  Archived months: [dec2021] [feb2022]

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