General C++ Programming - December 2013 (Page 3)

Finding the longest path in a graph
 
I was asked to find the longest path in a graph. I was thinking about using Dijsktra's algorithm after multiplying all the weights with -1 and run the program i...
[2 replies] Last: Adjacency list is your best option in this case http://en.wikipedia.o... (by Smac89)
How to move a ball continuously in 2D scrolling game ?
 
Hello people, I have just started with learning how to make basic games in c++. The situation is , I have a ball which should move on a flat horizontal ...
[7 replies] Last: ball.pos.x = background.center.x; Why did I use background.center ... (by Smac89)
by OUIJ
seedin a vector with 52 unique values
 
I am trying to seed a vector with 52 values ranging from 1 to 52. I already have the code written to seed the vector but I cant figure out how to keep from repe...
[3 replies] Last: Thank you Luke and Cubbi. I have only taken C++ 1 in school and am tak... (by OUIJ)
Why can't unary operator & be applied to constants?
 
I came across this: "The & operator only applies to objects in memory: variables and array elements. It cannot be applied to expressions, constants, or regis...
[1 reply] : Whoever wrote the sentence, mixed up quite a few concepts. What they p... (by Cubbi)
Friend functions and classes not permitted to data
 
I have a situation: I have a class character class Character; class Village; class Character { public: //Functions void charGen(); //...
[4 replies] Last: Thanks! I will try these solutions! (by TsarLenin)
by djnewg
language autoit to C++ ???
 
hello, I'm big problème i have old program and i'm new QT for create a new appl. Juste cause... autoit with a GUI and QT it's not this. Case $BTN_GetU...
[no replies]
pitfalls of macro substitution
 
"If you examine the expansion of max, you will notice some pitfalls. The expressions are evaluated twice; this is bad if they involve side effects like incremen...
[1 reply] : Macros are textual substitution, they're basically a copy-paste mechan... (by Catfish666)
Xorshift RNG
 
I tried to use the following code to generate random numbers but it always show me errors first is that t is not declared in this scope #include <iostream> ...
[1 reply] : [code firstline=7]unsigned long xorshf96(void) //period 2^96... (by long double main)
sort algorithm
 
In the below sort algorithm, let's say left is 0 and right is 9 and v is an unsorted integer array from 0 to 9. At one part is sets left (0) to last. Then it se...
[no replies]
Quaternions for rotating Vectors
 
Hey C++ Community, i got a problem here, i try to use quaternions to rotate one(and later more!) 3d-vectors in a general manner. i read in wikipedia, tha...
[7 replies] Last: I don't know if there is a simpler way, but you could take one of the ... (by ne555)
by Kubani
How to reverse a text file (1,2)
 
If we have a text file containing the string: abc , how to reverse it to be cba using file open modes ( ios::app , ios::ate , ios::binary , ios::trunc , ...
[20 replies] Last: Yeah, you are right but keep in mind it's not a real program and also ... (by Kubani)
Initializing a 2d dynamic array with all entries 0
 
is it possible to create a dynamic array with all entries in it equal to 0? int** adjMatrix; adjMatrix= new int* ; for(int i=0; i<numOfVertices; i++){ ad...
[1 reply] : You can tell new to initialize the values to zero by putting a pair... (by Cubbi)
I (almost) finished my first book on programming, now what?
 
I'm on the last chapter of "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup. The main thing I learned for my first book on C++ is that a ...
[7 replies] Last: Thank you, This belongs more in the lounge, but By the way, Tim O'... (by Largins7)
by VinKol
C++ write to file, save as..?
 
Hello everyone! i just made this ---> #include <iostream> #include <fstream> int main() { std::ofstream YourFileName; std::string TxtIn; ...
[6 replies] Last: Edit: how can i print this > void main_2() { std::string Coutnam... (by VinKol)
Object Oriented Program (OOP)
 
Hi everyone. This is my first post in the Cplusplus website, so I apologize if I mess up. I'm a beginner at programming; I have been working with C++ for o...
[5 replies] Last: Hello, What was he smoking when he gave the assignment? Or you whe... (by Largins7)
Msys install not working
 
When I install msys, I get the following error: :\msys\1.0\bin\sh.exe: *** Couldn't reserve space for cygwin's heap (0x1470000 0x1580000>) in child, Win3...
[3 replies] Last: I don't have Cygwin. I should have specified that. Also, it is worki... (by IWishIKnew)
C++ Help Needed
 
How do you randomly select a uniform value from a range of numbers?
[1 reply] : #include <random> #include <chrono> #include <vector> #include <iost... (by TwilightSpectre)
convert string to double
 
In the below function, it muliplies "10.0 * val". Why does it use 10.0? If you remove the 10.0, the return value will still be a double. #include <ctype.h> ...
[1 reply] : I guess is it could slightly be for efficiency (though some of the oth... (by TwilightSpectre)
by chry44
C++ help!
 
hello guys! i am new in here...I have a C++ homework assignment that wants me to create three functions. I just wrote the first two functions and I need your h...
[15 replies] Last: i didn't ignore your advice but it was not the complete coding ... i w... (by chry44)
Opengl
 
Does anyone know how to get opengl working in code blocks? I have tried putting in the libraries and such in the correct folder. But I get an error saying that ...
[1 reply] : http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/ (by Chriscpp)
December 2013 Pages: 12345... 37
  Archived months: [nov2013] [jan2014]

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