General C++ Programming - June 2016 (Page 4)

Understanding Statements
When reading the problems to convert to C++ how do I know which statement to use? ex. when the problem asks to got the Square root of Numbers 4 to 9, ---I k...
Jun 22, 2016 at 11:20pm
[1 reply] : Your question is akin to asking "I have this story I want to write. Ho... (by helios)
code robustness and const keyword
This question is out of place: the thread was closed before I noticed it! Sorry. IDM says: Use const wherever you can get away with it - it's a big advan...
Jun 22, 2016 at 6:50pm
[5 replies] Last: Some other basic ideas about robust code. An overall thought is: What... (by TheIdeasMan)
Find the logic errors
This is example code from "Principles and Practice using C++" by Bjarne Stroustrup, and we're supposed to find 3 logic erros in this code. This drill has been g...
Jun 22, 2016 at 4:50pm
[8 replies] Last: Never mind. It's working! (by lbourbon)
Question about using variadic templates with template patterns
In trying to solve my latest programming dilemma I learned about variadic templates. However, I have been unable to find how to use/access the argument list wh...
Jun 22, 2016 at 2:28pm
[5 replies] Last: #include <iostream> #include <typeinfo> #include <type_traits> #inclu... (by JLBorges)
by wakeup
An ATL class as member of another ATL Class
I have an C++ ATL COM DLL (VS2015) with two ATL Clasess, and I would like to add one of them as a member of the other ATL class. How should I do it? I tri...
Jun 22, 2016 at 1:40pm
[no replies]
by Vabi
unable to return string from function
Hi, I have tried a program in which I wrote a function to get name from user and then I want to return that user name to main program. When I execute it wil...
Jun 22, 2016 at 12:36pm
[4 replies] Last: Exactly, that's the reason I did it that way! XDD (by closed account 48T7M4Gy)
How do I refactor two classes with similar functionality?
I have classes with methods with the same names that do the same thing yet they are implemented differently. Ex: class converterA { map(Item1 item1)...
Jun 22, 2016 at 12:18pm
[3 replies] Last: I believe you can use a template interface with pure virtual functions... (by primem0ver)
How to run through a two dimensional matrix by using pow(2,n)?
I am trying to run through an array and its dimensions are being created as the program runs. I want to run specific elements of the array as array[0,columns/2]...
Jun 22, 2016 at 8:06am
[3 replies] Last: Thanks! It was solved! (by Poetjockey)
by rpsalh
acos not working
i was making program calculate basic things about shapes but when i used acos() for calculating angles between sides it didnt work it only gave the value of an...
Jun 22, 2016 at 7:15am
[8 replies] Last: Cheers, I'm glad you found it. :) (by closed account 48T7M4Gy)
binary search tree insert complexity
Could somebody please help me do a complexity analysis(deduction) of the insert algorithm of a binary search tree? I have no idea how to explain it in writing.
Jun 21, 2016 at 8:31pm
[5 replies] Last: Never mind. I think I know it now. It's like 1+2+2^2+...2^k = n. That ... (by closed account GTMi1hU5)
Templates - Help
Hi there, I have a question about templates and I have been banging my head against a wall with this for 2 days... I think I have tried and googled everything b...
Jun 21, 2016 at 5:08pm
[9 replies] Last: H i and thank you for all the replies, btw fcantoro I know my origina... (by newbie78)
specifying header filepaths for MANY different paths
Hi guys. I'm trying to get a library I've downloaded to work with a project in Dev-C++. The problem is that the header files are scattered all over the place ...
Jun 21, 2016 at 4:03pm
[6 replies] Last: > OpenCV has too many directories for me to drag and drop into a diff... (by ne555)
by noob96
C++ Error: call of overloaded function is ambiguous
I have defined a function in one file - void c2bc( std::string& filename, std::string& outname ) { std::ostringstream cmd; cmd << "clang-3.6 -emit-llvm -O0 -...
Jun 21, 2016 at 12:40pm
[10 replies] Last: It turns out I actually wanted to call parse_cpp_file function and not... (by noob96)
Help for memory management
Hi In the code below ,my question is when i delete sss , what happens to allocated memory for "*x" in str ? #include <iostream> using namespace std; struct st...
Jun 21, 2016 at 10:06am
[3 replies] Last: Yes. A class is identical to a struct in every way, save one: the de... (by MikeyBoy)
by elay
help about best way
is it only okay for setter function definition to be more than 1 line? void Class::setter(c obj) { if ( obj.A > 1 && obj.A < 10 ) myData = obj; } ...
Jun 20, 2016 at 7:11pm
[4 replies] Last: i was thinking about which one is the best way First what happens, i... (by jlb)
memory allocation for array
How do I make a million ints? I can't do it with subscripted arrays. I can with dynamic memory allocation and then pointers. Is there another (easier) way that ...
Jun 20, 2016 at 9:56am
[8 replies] Last: Hi, Note that the pass by reference should be used for any of the STL... (by TheIdeasMan)
Frequency counting in large arrays
Hi! Alright, so i'm just starting a data structures class, and we're studying arrays. We were asked to come up with a some code to match multiple entries from t...
Jun 20, 2016 at 4:46am
[13 replies] Last: http://www.cplusplus.com/reference/algorithm/set_intersection/ (by closed account 48T7M4Gy)
How to initialize a vector of structs with user data
I would want to initialize the following struct with user data using a vector of strings as below, how do i do it because it wouldnt run ? code starts here: ...
Jun 20, 2016 at 4:04am
[3 replies] Last: You'll have to iterate through the vector (use a for loop) and check... (by Duthomhas)
by yiddo
Unknown mistake from a Textbook example
Hello guys. I'm involved with C++ for about 3 weeks by now. So far i enjoy the learning process. Something strange occured today tho. I copied this example from...
Jun 19, 2016 at 10:55pm
[4 replies] Last: I thought that my compiler is set by default for C++ 11 version, appa... (by jlb)
long long integer is down casted to int
Hi, The below program is used to count the no of inversions in an array.The program works fine for small input but for large input it fails as there is overflo...
Jun 19, 2016 at 7:56pm
[2 replies] Last: Yeah,Thanks that was the problem. (by abhisheksinghbiet)
June 2016 Pages: 123456... 14
  Archived months: [may2016] [jul2016]

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