General C++ Programming - October 2010

Multidiminsional arrays
 
Begin by writing a function named countScores to accept the list of scores and return an array of one hundred and one counts, one for each possible score on a o...
[2 replies] Last: I tried changing the < at line 71 and using counts in the void writeHi... (by wassabi)
Median formula problem
 
hello , i want a formula for calculating the median of an even array
[10 replies] Last: Just for the notice, although his code is nice, the ternary operator j... (by Kyon)
Best way to extract floating point numbers from a text file
 
Hi, I have a text file and I am looking to extract the floating point numbers from that file, there are characters too in that file....can someone please sugges...
[5 replies] Last: Then you probably want fscanf(): http://www.cplusplus.com/reference/cl... (by Galik)
singleton pattern
 
I've heard many people say the singleton pattern is evil. In my games I make my visualisation class a singleton class, so that all of my enemies, bullets, scene...
[1 reply] : Singletons are evil for all the same reasons globals are evil. Any co... (by Disch)
by Xoric
DirectX9 Shader - General Question
 
Hello everybody, I hope this is the right board to post in. I'm programming a game in C++ and DirectX9 and just added a shader to my project. The shader is v...
[no replies]
C++ Write to file but no overwrite
 
I've already read " http://www.cplusplus.com/doc/tutorial/files/ ", maybe I didn't look close enough. But is there a way to keep writing to files, like a log, b...
[2 replies] Last: Ah! I see! As always Albatross to the rescue. Thank you so much!! (by LittleQuick)
by suds
returning a letter from score totals
 
I'm trying to creat a function that will take the score input and give the output in a letter grade form of the total that got the score within that range. ...
[2 replies] Last: // Just something for no reason. #include <iostream> #include <ccty... (by thediamondsaint)
Why won't the window appear?
 
I made a class and a few functions to simplify winapi programming, but after I added it to the code, the window stopped appearing... So, does anyone know what's...
[2 replies] Last: Oh, derr. Thanks! (by PiMaster)
odd number -> even number in an array
 
This is a homework, so I will not ask for the full code, I need a part of it. I need a working code for an algorithm, that checks if an even number follows an o...
[1 reply] : You're always checking the last value in the array and the one after t... (by Athar)
Find length of floating point numbers
 
I need some help on how to find the number of digits in float/double numbers. Can anyone suggest a suitable function? Example : if the number is 2.569845, th...
[1 reply] : Floating point numbers are stored with a weird format in binary. When... (by Bazzy)
by Hiner
How to check type of Handles?
 
I have 2 ref classes. I want to make some code to check the type of handles, not pointers. For pointers, I know that I can use dynamic_cast to check, see he...
[2 replies] Last: I mean handles to managed objects. I know how to check types of point... (by Hiner)
by tomato
C++ operator overloading problem
 
I want to do some fraction operation,my code has no error but can't run. who can help me correct it,thank you very much. #includte<iostream> using namespac...
[2 replies] Last: thank you very much,I got it.. (by tomato)
finding mode without pointers
 
hello , i want to ask is there any function that gets the mode of an array without using pointers ???plz tell me if there is
[6 replies] Last: [quote=Juan Soulie]I recommend the reading of the chapter about Pointe... (by Albatross)
Using if_ndef with cpp files
 
So I have this class in main that I want to use in another file Square.cpp. However, I include Square.h in main.cpp. So I put an ifndef define endif block aroun...
[4 replies] Last: Thanks devacool420 (by dunsondog109)
by nquadr
Coding Question
 
Write the code for a method named calculateTax that accepts a double parameter named subTotal and a boolean parameter named isFresno and calculates and returns ...
[3 replies] Last: #include<iostream> using namespace std; void calculateTax(doub... (by nquadr)
using an object of a template class as a parameter
 
Hi, I've written a template class: template <typename T> class example { public: T value; .... }; and I use an object of this class...
[1 reply] : The only idea i had was to overload the function with any possible da... (by ne555)
How to set a pointer to an object in set?
 
Hello all! I have a std::set<Sense> all_synsets; defined in my main procedure. Afterwards I wanna call a procedure where I can point to an element of the s...
[7 replies] Last: The & is the 'address-of' operator, as in "what is the address of n... (by Duthomhas)
Erray Expander
 
I am having difficulties with a program I have written.My program will compile, however, it does not make the numbers "expand" or double. I would appreciate if ...
[10 replies] Last: Thank you for pointing that out to me. I think I am going crazy lol. I... (by TayKaye)
Associative containers and Two comparison Functions
 
Hi Item 19 of effective STL advices us to learn the difference between the equivalence and equality in STL containers. In short, the author says that, equiva...
[1 reply] : The problem is that it would mess with the container's ability to do w... (by Duthomhas)
Parallel Array reading and bubble sorting
 
I am having trouble initializing some parallel arrays using an input file. I am only able to get the first two items out of the file and the rest is random num...
[no replies]
October 2010 Pages: 123... 23
  Archived months: [sep2010] [nov2010]

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