General C++ Programming - January 2022 (Page 3)

by frek
C++ threads
 
Why is the operator's message printed and then the function's while they've been defined and join ed the other way around in the code below? #include <iostre...
[12 replies] Last: Pass the object by value. void f( std::vector<double> v ) { // the f... (by JLBorges)
bug code
 
Below code gives some bugs some inputs which seems to be incorrect, which I am trying to figure out, there focus on correctness of the code rather than performa...
[8 replies] Last: Thanks a lot lastchance, I am studying your code, it helps a lot. (by leo2008)
by Cplusc
Visual studio freezing all the time
 
Hello everyone. I've got a problem with visual studio for several days and I have tried many many things to fix it but no success. I had visual studio 2017 prof...
[4 replies] Last: @jonnin thanks for the answer, I tried the latest version as well, but... (by Cplusc)
Could someone help me with an assigment?
 
Hello! I'm a new female coder and I have started getting Computer science assignments but do not fully understand some of them. Can someone please help me with ...
[8 replies] Last: > Doesn't modern C++ have an (optional) "Thou shalt not ignore the val... (by JLBorges)
by see17
Communicating serialized objects over network
 
Hi, I am a student working with this library https://github.com/microsoft/SealPIR/blob/master/main.cpp which demonstrates a "query" (L79) and "reply" (L90). The...
[16 replies] Last: Makes sense, thank you all for clarifying! One more question: I also ... (by see17)
Standard filesystem time types
 
Hi all, https://en.cppreference.com/w/cpp/filesystem/file_time_type #include <iostream> #include <chrono> #include <iomanip> #include <fstream> #include <fil...
[1 reply] : For C++17 you need to supply a TrivialClock * for the time point inst... (by George P)
Declaring a probability distribution within a class
 
I would like to declare a probability distribution within a class. Why does the desired form (2) in the below code fail, but any of positions (1), (3) or (4) wo...
[2 replies] Last: Thank-you, @coder777 (by lastchance)
by frek
C++ text file writing and reading
 
Exercise says: Write integer numbers into a text file and then read from them. I wrote the code below for that. Any comments? #include <iostream> #include ...
[18 replies] Last: > What makes you define the class inside main()? > Classes/structs are... (by JLBorges)
C++ LL issue
 
The length of list is total num of nodes it contains. So am empty list has length 0. For example consider the below linked list. Below linked list : has 4 nodes...
[8 replies] Last: Then possibly just simply: #include <iostream> struct IntListNode ... (by seeplus)
implicit conversion from void to T and T to void?
 
Hi, Looking at the code for Loki (Andrei Alexandrescu) there appear to be code that says that there is an implicit conversion from void to T and from T to vo...
[1 reply] : You need to see this in context. Loki was full of mind/compiler bendin... (by kbw)
GDIPLUS: can i draw an image using corners?
 
the Gdiplus::Graphics::DrawImage() have a way for draw using coners? or the rotation points?
[7 replies] Last: sorry... not rounded... just normal corners. but adding the 4 points, ... (by Cambalinho)
by frek
A class and two operator overloading (1,2)
 
The exercise says: store several (name,age) pairs in a class. Doing the reading and writing using your own >> and << operators. I've written a code for that ...
[21 replies] Last: > The exercise says: store several (name,age) pairs in a class. > D... (by JLBorges)
Is there a simple way to improve this for lists?
 
Basic template version of finding max number of consecutive values in collection. But I believe for list, std::distance() is non constant time. I could writ...
[1 reply] : Note that bind2nd() was deprecated in C++11 and removed in c++17. I su... (by seeplus)
Unable to find error in Sorting & Searching codes
 
Hi, this is my first time coding a searching and sorting program so I have a hard time finding what is the error I am having now. I hope someone can help me cor...
[4 replies] Last: I suspect the assignment is to create a sorted list and search it. Hen... (by Duthomhas)
Database query for search
 
Hi all, I've got a query please that any comments would be greatly appreciated. I have a program done already which is a hair salon booking appointment C...
[7 replies] Last: thanks so much again jonnin, really appreciated your help x (by ikindalikestevejobs)
by frek
C++ pointers
 
Hi all, Running this code: #include <iostream> int main() { int* pn1 = new int{ 5 }; int* pn2 = new int{ 25 }; double* pd = new double{ 9.5 }; std::co...
[16 replies] Last: This may (if reallocation is required) invalidate pointers to previous... (by jonnin)
Function Help Problem
 
Hi guys, can someone lend me a hand in the problem below? I'm having difficulties in making the program below. Build software that sets two numbers, 20 and 10....
[12 replies] Last: Just remember that 'throwing' is 'expensive' in terms of performance..... (by seeplus)
Array Comprehension Problem
 
Hello. I'm currently studying array right now and I have a question regarding the code below. How do I get 65 from the output, The sample array is A = 65? Can s...
[3 replies] Last: Try changing to in L13 and see what is then displayed. Then relate... (by seeplus)
I have some spare time, What C++ library should I write?
 
I am looking to start working on an Open-Source C++ side project and am in need of good ideas. I am quite experienced writing in modern c++ after about 2 yea...
[1 reply] : What about a library for creating ebooks - .epub or .mobi. (by thmm)
string_view as a value vs as an rvalue?
 
So I have a templated function, SetMessage(), that takes a string_view as one of its arguments: template <typename... Args> constexpr void SetMessage( std::s...
[1 reply] : Not a few minutes more of searching did i find my answer... https://st... (by USAFrenzy)
January 2022 Pages: 1234
  Archived months: [dec2021] [feb2022]

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