Beginners - February 2009 (Page 6)

by jaydr
calc in function not working
 
float calcbavg(int hit,int ab) { float ba; cout << hit << "\n" << ab << "\n"; ba=(hit/ab); cout << setprecision(3) << ba <<"\n"; retu...
[3 replies] Last: The compiler always converts operands to the more accurate type if the... (by helios)
What are header files used for?
 
I don't get how and when you use header files. I've always been programming with everything in one big '.cpp' file. I'd be grateful if somebody would explain th...
[9 replies] Last: Oh OK, that solved it! Thanks for all your help! (by user name)
reading a file
 
I having trouble with reading the entries. When I select 2: it only reads the entries on the first interation and faults when opening the file with two or more ...
[no replies]
by hei
How to open a file by fopen or other open file command?
 
#include <iostream> #include <fstream> using namespace std; int main(int argc, char *argv ) { int x ; char y ; char str ; char...
[2 replies] Last: Now my main problems is how to open a the file that i mentioned? And y... (by hei)
newbie Array
 
Hi, Im trying to write a program and am having trouble linking I can link my array with char* fine but not int? why is that it keeps saying error C2109: su...
[11 replies] Last: 'A' should be declared as int* , you seem having declared it like thi... (by Bazzy)
how can i change the color of fonts in programs?
 
it is possible? i'm making my case study and i want to be nice..^^
[1 reply] : Look through here - ( http://www.cplusplus.com/query/search.cgi?q=fore... (by Mythios)
when i run my program in dev c++ my computer always shut down
 
when i run my program in dev c++ my computer always shut down. can you help solve it now. please.. help me.. thanks
[4 replies] Last: i know the problem..^^ my computer has virus.^^ i didn't knew it becau... (by kayem01)
SOLVED: Problem: Using a variable of other class
 
I guess my problem is easy to solve but I'm newbie for C++ so I don't get it: I have 2 classes, ClassA and ClassB. ClassA has a variable and its value is nee...
[3 replies] Last: Problem solved, I haven't created an instance for ClassA object. Such ... (by bunkerder)
How do I test a loop midway, save the answer, and output it at the end?
 
For instance, for this program, I need to determine when the total number is over 500, then display the answer after the table is displayed. Here is the code: ...
[1 reply] : I assume the loop need to be determined when total is over 500, and an... (by Scipio)
Class data members
 
I have Class MediaClass { public: void InputMedia(); void DisplayMedia() const; private: int qty; string title; } I am us...
[2 replies] Last: There's probably a problem with how you're inputting them (from code, ... (by helios)
self-aborting class object?
 
In a class I am working with, the constructor creates an ofstream object (I know, I should accept a reference to one instead, but this is for educational purpos...
[2 replies] Last: The singleton pattern could be used for something like that. You coul... (by seymore15074)
by masiht
indentifier question
 
hello I have a question, when do we use double value=0.0; and when do we use double value; or what is the difference ?
[8 replies] Last: I didn't get . please explain in words (by masiht)
giving 1 second to press 'g'
 
Hi I'm making a small game and I need a way to give the player 1 second to press 'g' (and maybe 'enter' afterwards). /*I use Borland 2006 and I code in a mi...
[2 replies] Last: I works, thanks! (by balanovich)
[solved] enum -- OOP hostile?
 
Enumerations seem to break the rules of OOP. My understanding is that changes to the implementation should be invisible to the interface, but that's not really ...
[4 replies] Last: changing enum evil to an integer You're still confused. That's like ... (by Ganellon)
arrays with infile
 
heres the deal. i was in the hospital for 5 days and during those five days i missed the whole section about arays in class and i just cant figure out how they...
[6 replies] Last: what do you mean? if you dont take them from the array, is there some... (by helios)
by jaydr
floating rounding during output
 
I and trying to have a float display a certian number past decimal point no matter if the number is 1.0 or 1.1 of 1.11 or 1.1111. I can't find anything that can...
[5 replies] Last: Found my answer. Thank you for all your help. Now all i have to do is ... (by jaydr)
Secure input validation method to protect buffer overflows?
 
I am writing programs now and i always use basic input validation e.g testing each character by using a loop and using one of the functions from <cctype> like i...
[1 reply] : Here is an article on secure input: http://www.cplusplus.com/forum/art... (by Bazzy)
by Brutal
[solved]prime number (I have searched around)
 
I am having a problem =/ My program will determine if a input number is a prime until I enter something over 200 =/ I am not understanding it. 199 works fin...
[2 replies] Last: Thanks a ton! I finally figured it out with your help! All I needed ... (by Brutal)
run time check failure newbie
 
Keep getting a run time check failure to intialise
[1 reply] : I need more information than that to give you specific help, but it lo... (by Zhuge)
by Xyzk
Loop is ending too early
 
Argh... I feel brainwashed...braainss.. The problem is in the first loop of a program, if iIle=2 then it takes string only once (should take twice) and so on...
[4 replies] Last: I would avoid using cin>> in the first place and replace it with getli... (by Scipio)
February 2009 Pages: 1... 45678... 22
  Archived months: [jan2009] [mar2009]

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