General C++ Programming - May 2010 (Page 7)

by wtf
Getting around rand()'s limitations.
 
Say if you wanted to hash the value from 2 different calls to rand() at different seeds, what would be a simple and efficient way of doing this, and is it possi...
[2 replies] Last: Take a look at this, and also tell me what you think of it: http://cp... (by m4ster r0shi)
Exceptions problem
 
Hi, i wrote this code and i can't understand why it doesn't work. Compilation works fine, with no errors. When i run it, it derails action. Can anyone help me, ...
[2 replies] Last: Thank you :). Simply throw 1; and catch(int nr){} make, that all w... (by mtweeman)
Brackets by themselves
 
Hi, if I have something like this in my code: int main(int argc, char **argv) { int *p; { int i = 5; p = &i; } *p = 6; return 0; } ...
[1 reply] : will the declared variable i be deallocated after the duration of tho... (by R0mai)
wrong dynamic array size
 
#include <iostream> #include <time.h> #include <conio.h> #include <windows.h> using namespace std; class name_box{ private: char line ; int chars; ...
[1 reply] : On line 17 you delete a char* with no value. This causes undefined beh... (by Galik)
Character reading problem!!
 
I have a loop in my code, something like this: while(1) { char c=getc(); Sleep(50); run_next_animation_frame(); } I need animation to run, no m...
[4 replies] Last: thanks! (by thunder87l)
Center Alignment.
 
i wish to do an output like this~ Sample Run 1: Enter height: 3 * *** ***** Sample Run 2: Enter height: 5 * *** ***** ******* ********* m...
[1 reply] : Perhaps you're thinking too complicated. You just need to add an appr... (by Athar)
by indigo
queue not working as expected
 
Hi everybody, my simplified console application code: ... queue<char*> pQCh; ... void thread1(void *data); ... void main() { ... _beginthread(th...
[4 replies] Last: Thank you guys, it helped much :) I used string for queue type and it... (by indigo)
my sorting algorith
 
Hey guys, while in my algorithm and data structure class, we where learning about sorting algotithm, and this one just poped in my head, and i want ur opinion o...
[9 replies] Last: Indeed its worst and best case complexity appear to be O(n). Howeve... (by M364M4Ncro)
a shallow copy constructor
 
Say I have Class1 and Class2 and I want a shallow copy constructor for Class1. Class1 has a member variable, which is a pointer pointing to a Class2 instance. A...
[2 replies] Last: I suppose an alternative would be to make the class2 pointer indepen... (by guestgulkan)
permutation of array[i][j]
 
now i know permutation become n*(n!) complex so I'm not trying to perform large permutations (just yet). I have an array that is created, so far its just a...
[2 replies] Last: you know its sad...i had to look at that page 100 times and I never th... (by liltimtim)
fast comparisons of strings
 
I have to compare several times two vectors of strings. Each string contains "0", "1" or "2". Ex: vector1 = "0001002001" "0200011001" and vector2 = "00102020...
[12 replies] Last: Thank you so much m4ster r0shi!!!!!!!!!! Indeed, the idea being calcul... (by courtiol)
linked list vs array
 
Hi, I just wondering the advantages/disadvantages using a linked list and an array. I have to design a tree-structure with internal nodes and leaves. Norm...
[2 replies] Last: Thanks for the link. I figure out the standard vector class uses ar... (by jesperd)
tempalte as the overloaded conversion operator
 
class WIDE { ... template <typename A> operator A () { A a; ... A::static_member <---- line 20 } } template <int x, int y> c...
[1 reply] : Why do you have to do this -> template <int x, int y> class NARROW ? ... (by m4ster r0shi)
OpenGL with SDL Blitting
 
Hey All, So i'm using SDL on top of previously created GL images (using glVertex). I have everything setup through SDL but my bitmap images are not drawing a...
[1 reply] : try adding SDL_Flip(getSurface()); to the end. not entirely sure i... (by Azriel)
Run time errors
 
After compiling my big integer class, using list base description, without any error, then I run the program and have the following error: Enter the first...
[no replies]
by panski
Infix to Postfix
 
Hi I recently just finished my program about converting Infix to postfix, it runs okay when I input addtion+, division/ and multiplication* sign but when I inpu...
[no replies]
loops
 
Can anyone just explain to me why this loop produuces this outcome. Outcome (bolded) j : 0 3 6 9 12 Outcome (bolded) i : 0 1 2 3 4 I never expected j...
[2 replies] Last: thanks (by gnwillix88)
Trying to pass input string to dynamic array
 
The visual studio c++ program compiles and build without errors. When i try to run it from the black screen, it says: Prgram.exe has encountered a problem and n...
[4 replies] Last: It worked. Thanks Albatross, your a lifesaver. (by computerpublic)
by shirin
composition
 
Write a C++ program that will find out the total amount of a customer's bill according to the items he or she has purchased. Create two classes: Purchased...
[6 replies] Last: Thank you so much!!!!!!!!!!!!!!!!!!!!!!!! Its very helpful. (by shirin)
by Azimer
add a win32 program to an asp.net web app
 
I have a working hangman program that outputs to the windows command prompt. What i would like to do is integrate it into Visual Studio Web Developer somehow ...
[no replies]
May 2010 Pages: 1... 56789... 22
  Archived months: [apr2010] [jun2010]

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