Beginners - July 2011 (Page 42)

#findef/#define in headers + cpp for definition.
 
I have a header file that i'd like to keep the definitions in another .cpp file. How can I do that with #ifndef/#define ... or is it even needed when definition...
[7 replies] Last: I found the sinner giving me errors -- declaration of global variable ... (by GisleAune)
I am trying to program a 2D/3D game engine
 
I´m from sweden. can be wrong speld a little. This is written in English not Swedish hope you will understand so I can get good help I am using C++ wha...
[2 replies] Last: you cant create an engine if you dont even know what it needs to be ab... (by acorn)
by eidge
files seekg and seekp always returning the same value
 
Conserning binary output files: Shouldn't get and put flags have separate values? When I output them, they both have the same values independently of me s...
[7 replies] Last: Understood. Thanks, Hugo Ribeira (by eidge)
compile problem in "Separating Interface from Implementation"
 
hi. i am new in c++ . i m reading "How to c++ deitel & deitel". in chapter 3 there is a proj; there are 3 file in it: fig03_13.cpp -------- #includ...
[5 replies] Last: oh yeaaaaaaaaaaaaaaaaaaaaa!!!! it solved . dear "hamsterman" was righ... (by wickietetsu)
Type Casting
 
I'm having a problem in understanding the difference when we type cast a variable from char to int and from char to double/float... is there any difference at a...
[6 replies] Last: Thank You so much!!!! (by Anurag7069)
binary to decimal conversion
 
i have written code to convert binary to decimal using array but pow(x,i) function takes only double as parameter but i cannot be double as i is index in array ...
[3 replies] Last: Problems with your code. ( I hadn't read it the last time I posted ) ... (by hamsterman)
by acorn
question about constructors and code i ran in to
 
I ran into some code and it sorta confused me. I was under the assumption that if you did not provide a constructor, one will be provided for you. also, if you ...
[7 replies] Last: Is that all the code there is? A private constructor could be used by... (by hamsterman)
How to output height of each node in BST?
 
I'm trying to output the height or level of each node in a binary search tree. I've tried a lot of algorithms but I had to scrap them. I'd like to be able to ...
[1 reply] : Well, if adding a parameter to your traversal function won't mess with... (by shacktar)
Basic file input/output program
 
Hey everyone, This is my first post, although I have some history of eye-balling this forum when I was stuck on something. I'm trying to write a pretty basic...
[1 reply] : I solved my own problem. Here's the code. #include <iostream> #inclu... (by bool maybe)
no instance of specialized template matches the specialized type!
 
So I've had this problem every time I try to make my own specialized template, and posted about it here once, in which I got an answer and thought I understoo...
[6 replies] Last: Well, to be honest, there isn't much benefit to function template spec... (by jsmith)
Can type bool variables be assigned 0 in place of false and any integer in place of true?
 
Can type bool variables be assigned 0 in place of false and any integer in place of true? Sorry if this is a stupid question.
[2 replies] Last: You will have to cast, however, and then when casting it will give you... (by LB)
by D C
How to remove the last character when reading a line?
 
I'm reading a .txt data file line by line and copying it into another .txt file and it keeps adding "\"that at the end of every line. How can I get rid of i...
[2 replies] Last: Hmmm....... here's my code.... don't think it's wrong..... :/ Btw, I ... (by D C)
Word count?
 
I need help understanding a problem. For a homework assignment I need to create a word counter using a string variable and a .txt file. I am using Dev-C++ and t...
[4 replies] Last: Ok I see! Thank you very much! (by James352)
Hello all! I really need help! x)
 
Hello all, i'm alexandrji and I found this website for the obvious reasons. I need some help, here's the deal. I want to make a browser game (if needed, I...
[6 replies] Last: C++ does not have any inbuilt support for graphics. If it did, it woul... (by LB)
Why is a true condition referred to as non zero?
 
Why is a true condition referred to as non zero?
[10 replies] Last: No, as hamsterman said there is a completely different reason. Casting... (by LB)
Counting how many times a loop executes
 
I'm having a hard time figuring out how many times a loop executes and what the output is given a code. Here's an example: count = 1; while (count <= 12) ...
[1 reply] : start counting from 1 untill you reach 12 and see the figure. This is ... (by writetonsharma)
Why is hexadecimal used?
 
"In programming it is sometimes easier to use hexadecimal or octal" How is it easier/what advantages does it offer in some situations over decimal?
[4 replies] Last: that was funny Intrexa... :) (by writetonsharma)
by mojoe
Proper syntax of Do while and sentinel in a multi-function program
 
Below I have a payroll application that is fully functional but it doesn't work the way that I would like it to. I have stared at it for a couple hours and I've...
[5 replies] Last: (ypmick2007) ?? (by closed account z05DSL3A)
A small quiz.
 
This is just some testing i done so far. So i tried to test this and in code blocks i got red on "int questionone;" #include <iostream> using namespace ...
[6 replies] Last: the problem on you code is that.: you initialized the questionone =1 ... (by ypmick2007)
Problem passing (char *s) into a class
 
I'm following an example from the book C++ without fear and it seems to fail. I have a class with a constructor that takes a string input (I've included the fu...
[6 replies] Last: You probably should get a newer book. Because my edition is dated marc... (by eidge)
July 2011 Pages: 1... 4041424344... 54
  Archived months: [jun2011] [aug2011]

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