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

changing a classification code
 
Hello, I found this code on the internet (https://programmersought.com/article/52001300562/). I managed to correct the errors that prevented me from compiling i...
[15 replies] Last: Quote from stackoverflow.com : Results (Average of 100 runs; timed u... (by oneidacharisse)
Reading part of a file
 
Hi, I've been wondering if there's a way to show only some part of a file when it reaches a limit, i.e I have this code that shows the latest orders of a restau...
[3 replies] Last: check out binary mode struct order{ int day, month; int order; dou... (by ne555)
Passing anonymous object to thread does not return
 
I'm passing two separate anonymous class objects to two different threads. It's not clear why the first object does not return. I should get: C1 C2 If I c...
[3 replies] Last: Thank you (by VMsrVT2Tyc)
Looking for MySet class examples
 
Hi there, Im trying to do kind of a project of sets that contains the following: 1) A parameter-free constructor that creates an empty set. 2) A constructor ...
[3 replies] Last: you should be able to find a class that does math sets in c++. be warn... (by jonnin)
Data Structures and Algorithms book recommendation
 
Hi, My semester is about to start and I wanted to start my course before the classes begin. I wanted to know which Data Structures and Algorithms book is begin...
[12 replies] Last: the one for your class actually looks like it covers and explains a lo... (by jonnin)
by Noone1
CIN problem.
 
Hello, don't know why the while_loop doesn't execute with CIN statement. It printed the statement before entering the loop, but it seems not entering the loop...
[3 replies] Last: On Linux, if you've already begun to type something on a line before y... (by salem c)
access violation ifstream class?
 
I don't understand why i receive access violation, when my constructor shouldn't be deleting? [HEADER FILE] #include <iostream> #include <fstream> #inc...
[8 replies] Last: the bool is the 'right' way to do it, IMHO. Now your code can be us... (by jonnin)
Build a wrapper class for array like objects
 
The wrapper class will have a constructor that will accept any array-like data structures like vector or array and convert store it as a vector variable present...
[4 replies] Last: Wouldn't it be better to use a range based for loop? template <cl... (by dhayden)
Pointer to std::function<>
 
I have a problem where I want to copy a std::function<> object around. The implementation of the actual std::function class is rather complicated -- it involves...
[8 replies] Last: Thanks for this. some good info to know. I can't pass a reference to s... (by VMsrVT2Tyc)
std:thread fails compile if #include<algorithm> is used
 
Following fails compile, but works ok if I remove the <algorithm> include. Compiler Error Message: error: no matching function for call to ‘std::thread:...
[2 replies] Last: some compilers must be forced into modern c++ with command line option... (by jonnin)
memory loss
 
I'm getting memory loss issues when checking with valgrind but I deleted the array so where is the memory loss coming from. #include<iostream> #include<m...
[12 replies] Last: using effective software engineering techniques to sidestep whatever ... (by zapshe)
template with smart pointer iterator
 
for (const auto& elem : coll) { What can auto be replaced with? I tried Coll::iterator but that doesn't work. /* The following code example is taken from...
[17 replies] Last: Using auto isn't just less error prone, it's much more flexible. For e... (by dhayden)
Problem with debugging the C++ code with eclipse on Mac
 
I've stumbled upon the following problem when using eclipse (on Mac) to code in C++. I want to start the debugging and stop at the first breakpoint but instead...
[2 replies] Last: I went to an actual total eclipse a few years back, and then I finally... (by jonnin)
How to delete (backspace) unsubmitted input from the command line after calling cout?
 
I’m trying to create a program that waits either until the user inputs a certain keyword or until a certain amount of time has elapsed. I’ve succeeded i...
[14 replies] Last: Thanks. All I could find was references for a readline() function. (by helios)
struct definition
 
I am used to defining a struct as follows: struct Point { int x; int y; }; with data members 'x' and 'y' where this is initialized as...
[2 replies] Last: #include <iostream> using namespace std; struct point { int x, y;... (by Manga)
by stav
container of container of incomplete type: UB or ok?
 
so usually you cant instantiate a std::pair with an incomplete type like so: class incomplete; std::pair<incomplete, int> myPair; ^This yields a compile err...
[6 replies] Last: just to rephrase i meant the incomplete type is only incomplete at th... (by MikeyBoy)
by dodo99
Refresh "modern c++" programming skill
 
I had programmed for C++ about 10 years but did not do any C++ programming (maybe once in while) after 2006. I still write code for living. I have been programm...
[3 replies] Last: There is also an online tutorial you might want to take a peek at, Lea... (by George P)
by abuh
Please help me
 
1) Design and implement a class Person. Each object of the class person contains the FirstName and LastName of type character pointer and Age of type int. Besid...
[8 replies] Last: It's not inappropriate but please realise we may never hear from @abuh... (by againtry)
recursive function and double linked list
 
Hello guys,I have doubts on how to do the function below can you help me? Consider a doubly linked list that stores the following student data from a discip...
[3 replies] Last: Hello you can find by using google advanced search with the dork as it... (by oneidacharisse)
getline function
 
So my class is taking a full name but for some reason when I use getline(std::cin,name) my program goes into an infinite loop. #include<iostream> #include<fs...
[2 replies] Last: I'll start by congratulating you on writing your << and >> operato... (by dhayden)
August 2020 Pages: 123
  Archived months: [jul2020] [sep2020]

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