General C++ Programming - August 2017 (Page 7)

Exercise 7.3.3 C++ without Fear 3rd edition
 
Revise the example so it implements the bubble-sort algorithm, which is potentially faster than the selection-sort algorithm. I just need to know what to chan...
[2 replies] Last: http://www.cplusplus.com/faq/sequences/sequencing/sort-algorithms/bubb... (by Duthomhas)
Creating CSV-file with small numbers content
 
I'm trying to find out how to get the right format when using ofstream when writing to CSV-file. When writing small numbers e.g. doubles, i want them to look...
[10 replies] Last: Required reading when messing with CSV files: http://creativyst.com/Do... (by Duthomhas)
by anogio
non const ref return type is bad?
 
I was recently told that a method should never return a non-const reference to a type like so: Foo& getFoo() { return m_foo; } I can th...
[2 replies] Last: Yes, that was my reasoning too. I thought it was odd that this person ... (by anogio)
by waruqi
A make-like build utility based on Lua for building c/c++ program
 
Introduction (中文) xmake is a make-like build utility based on lua. The project focuses on making development and building easier and provides many feature...
[no replies]
Water level control with arduino, help
 
Hi, I'm working on an assignment that needs to meet the bellow requirements. This is my first time using C++ and wanted to know if the code I've written is goin...
[3 replies] Last: Unfortunately I think you need a different approach. Consider this: i... (by dhayden)
Developing a non-STL list
 
Hi, I'm going to using the following code create my own List: #include <std_lib_facilities_4.h> using namespace std; //*************************************...
[7 replies] Last: Why did you declare first and last within protected scope and no... (by Frank14)
UART programming
 
I am writing a UART receiver, why am I getting line 65 instead of line 75 ? I have checked using minicom and there are characters being received, so I suspect i...
[9 replies] Last: line 16 seem like carriage return but it is printed as 'a' instead of... (by jlb)
advice on how to free memory leak
 
Hi everyone! I have to deal with a memory leak in a code that is not mine, and I want to ask for advice on what is an elegant way to free the memory leak. The ...
[1 reply] : Use value semantics, perhaps? class A { public: int a; ... (by JLBorges)
To Compare two rational numbers
 
I am trying to compare two rational numbers to see if they are equal or not, but there is a logic error. For example, 1/5 and 5/25 will give me an equal, but 1/...
[4 replies] Last: Comparing floating-point numbers for equality is dangerous because of ... (by lastchance)
by hychan
Best Book on Algorithms
 
I've learnt about C++ algorithms before, but until now I still can't use most of them properly in my coding, and there are some topics that I just can't compreh...
[11 replies] Last: @hychan This website is referred to at the cpbook site and might be us... (by closed account 48T7M4Gy)
by hychan
A Word
 
I'm trying to find a word that means printing only a part of the output in the middle of a program to check whether there are any bugs/errors in the algorithm. ...
[6 replies] Last: I did a little search on the Internet and found the word to be "loggin... (by hychan)
by Handge
Print a character based on variable
 
I know Google Spreadsheets has something like this =REPT("|",100) Is there something like that C++ has?
[3 replies] Last: char reps = {0}; memset(reps, '|', 100); only works on byte sized st... (by jonnin)
Undefined reference.......
 
I have a program like this: /*PROGRAM StatStar General Description: ==================== StatStar computes a ZAMS model using a number of si...
[11 replies] Last: I downloaded all the files from the reference I gave, replaced StatSta... (by lastchance)
almost done with my class!
 
Please help me finish my class! Thank you! Assignment 15.1 [95 points] This is part 2 of a two part assignment. Your score on this assignment will take in...
[1 reply] : http://www.cplusplus.com/forum/general/219811/ (by closed account 48T7M4Gy)
Having difficulty with assignment!
 
I am taking this class and am almost finished! This is the second to last assignment I have to do do but I am having computer issues. Please help me pass this c...
[3 replies] Last: http://www.cplusplus.com/forum/general/219812/ (by closed account 48T7M4Gy)
Multi Thread running after join
 
Ref: http://www.cplusplus.com/reference/thread/thread/join/ In below code, what I expect is t2 should print "pause of 2 seconds ended" in 2 seconds after t1 ...
[2 replies] Last: ... what I expect is t2 should print "pause of 2 seconds ended" in 2... (by gunnerfunner)
A strange limit for my quicksorting code
 
Here is my code The problem is when I change nNum, the size of the array, to 520241, the thing crashes. When it is 520240, the program (without printing all th...
[1 reply] : You may be running out of stack space. Try using an array with a stati... (by JLBorges)
String pattern matching expressions?
 
I'm not sure what you call the below but I'm trying to understand where to start learning about writing expressions to iterate through C++ strings. How do I...
[4 replies] Last: Start with a simple, minimal, tutorial introduction. For example: http... (by JLBorges)
PPP2 Chapter 16 Exercise 3
 
[I hope someone who's read the book or is reading it will (also) reply, if possible. Thank you.] My code: // Osman Zakir // 8 / 2 / 2017 // Bjarne Str...
[6 replies] Last: I'm not sure how the debugger will help in this case since I don't kno... (by DragonOsman)
by GregJ7
Template iterator confusion
 
A line like the following appears on en.cppreference.com/w/cpp/experimental/fs/directory_iterator: for(auto& p: fs::directory_iterator("path_to_a_directory")...
[2 replies] Last: I didn't want "auto" because I wanted to understand what was going on,... (by GregJ7)
August 2017 Pages: 1... 56789
  Archived months: [jul2017] [sep2017]

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