General C++ Programming - June 2012 (Page 6)

Nested Class Object Return
 
Class A { public x; class B { public: int Y B search(int tempx,int tempy)//not constuctor its memberfunction }; B ObjB ;TempB }; B A::B::searc...
[1 reply] : struct A { // ,,, struct B { int a ; int... (by JLBorges)
Need help with a assignment
 
There's a flow chart for an algorithm that displays the numbers 20,40,60,80,100,120,140,160 and 180 on the screen. Code the algorithm into a program; use the wh...
[11 replies] Last: It's a compiler setting, use google to search how to disable it or jus... (by closed account o1vk4iN6)
by apfela
While loop not exiting right after
 
I am having trouble when trying to exit. if i type -1 it still asks me "Enter gender" which I enter -1 again...which shouldn't happen ...if there's any way to n...
[1 reply] : The check to stop the loop happens at the END of each loop. The entire... (by Moschops)
by cdf
use variable instead of ostream cout
 
I have a class that recieves a cout in the constructor ( ostream* ) SO::SO(ostream* s) { //constructor logic } so in the main I have: SO so...
[2 replies] Last: 1) in the constructor, save s into a private member class SO { publ... (by Peter87)
sstream, type conversion, SDL, and bleh.
 
Hey guys, Basically, what I'm trying to do is use SDL to make a window, then use SDL_ttf to print out the xy coordinates of the mouse in said window. Now ...
[2 replies] Last: Awesome, that worked great! Applied, and found that the numbers were ... (by roger911)
Macros, When and When Not
 
What type of rule of thumb or Hueristics that you go by when you decide to defined and use a macro (besides compile time determination of what code is run). So...
[5 replies] Last: [quote=ne555]M_PI in cmath. Use it. M_PI is not standard. (by Peter87)
Option some compiller for 1 problem in C/C++
 
I have a problem like that : int main() { char *s ="hello world"; s ='H'; cout << s << endl;; return 0; } Be...
[7 replies] Last: You shouldn't be trying to "get this to run successfully". It's not s... (by closed account 1yR4jE8b)
reverse_iterator problems
 
Hi I am having some trouble with a string::reverse_iterator, my objective is to reverse a string using the iterator instead of reverse(). I know the problem li...
[2 replies] Last: Thanks vlad, I was using the != before I changed over to < to see if t... (by blueshift)
by mx760
BST insert
 
When the current node's L or R pointer is NULL, the new node is returned, BUT where do we assign it to the previous node's L or R pointer? So that's why I'm not...
[4 replies] Last: but still when a base case is reached, meaning time to insert a new no... (by mx760)
syntax: vector arguments as inputs to copy constructor
 
I would like to know how to initialise a copy constructor with vector arguments in general and for the following particular case. I am currently developing a...
[2 replies] Last: Hi, Thanks for your reply. I guess I'll stick with doing it that wa... (by dGold1947)
by Thommi
incrementation produces error
 
Hi, I hope you can help me with some (as I think) strange problem. I'm trying to read data out of a comma separated value file and put it into some variables....
[10 replies] Last: I found the solution here: http://www.cplusplus.com/forum/articles/745... (by Thommi)
Dynamically allocated array of dynamically allocated arrays of characters
 
can someone please show me an example on how this looks ?! how would my class's constructor look, if I use this ?! Example: class Test { private: char** na...
[2 replies] Last: To delete the array stick something like this in your constructor: f... (by BlackSheep)
deleting the object problem
 
Hi , Why am i getting the error while deleting the object in the main . #include <iostream> using namespace std ; class Base1 { public: Base...
[2 replies] Last: Thanks Blacksheep it worked. (by bluecoder)
by aj3423
lambda in static member function
 
struct A { static void fn2() { } static void fn1() { auto x = [&]() { A::fn2(); }; x(); } }; the code doesn't compile in VS2010, why? Thanks....
[3 replies] Last: Thanks, seems a bug of MS compiler struct A { static void some_uni... (by aj3423)
exception alternative, returning object
 
Hi In the function below, I need to handle the case if the singleLinkList is empty. One option will be throw exception. But if I have made not to use exception...
[4 replies] Last: In that function there is constraint that the node should not be null ... (by dearvivekkumar)
Converting string array to const char*
 
I've seen and read plenty of examples on the web telling me how to convert from string to char, string to char array and so on, but nowhere have I seen anything...
[4 replies] Last: for ( const auto &x : a ) { s += x; } c++11 <3 (by S G H)
Can't get this to work D:
 
Hi I'm trying to figure out how to get this program to output the models with the least price.But it keeps showing numbers instead. I'm still a beginner at ...
[1 reply] : You uses uninitialized variables in the code bpmjc = basepri... (by vlad from moscow)
by t36
Recommendations on how to improve C++ knowledge
 
Hi all, I have recently finished studying "C++ How to Program" and "C++ GUI Programming with Qt 4", so I think I have a basic grasp of C++. I am intereste...
[3 replies] Last: Hi, Thanks for your replies. I just studied the Qt to get a feel of h... (by t36)
by XzqtN
Must use Pass by reference
 
Hello all, I am faced with a challenge right now, I have an assignment that must be completed and I cannot seem to figure it out. The assignment is as follows:...
[2 replies] Last: You pass a variable to a function by reference so value_type& variabl... (by therockon7throw)
Name a variable with the value of another variable?
 
Hi! Something's just crossed my mind: Is it possible to create a variable and somehow name it with the value of another variable? For example: -The user i...
[3 replies] Last: You can use a hash table which can be used to relate a value to a stri... (by closed account o1vk4iN6)
June 2012 Pages: 1... 45678... 33
  Archived months: [may2012] [jul2012]

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