General C++ Programming - July 2012 (Page 5)

manipulating .dat file
 
Hi everybody, I read on here a lot but this is my first post. I have to create a program and after days of looking have not found an answer that i am content ...
[4 replies] Last: I finally figured it out, for anybody interested: Net Profit Code... (by kevinjame)
can't index 108th element
 
Hi all, This has been driving me nuts. There's probably something that already exists to do this function but I'm trying to do it manually to further my unde...
[2 replies] Last: ah cheers for that, I've now replaced <cv::Vec3b> with <uchar> it work... (by oliver9523)
trouble with using seekg
 
Hello, I am trying to input some data from a .csv file. The data file is 4 columns and any number of rows. I am trying to count the number of rows and then e...
[2 replies] Last: Excellent, worked a treat, thank you! (by adhughes)
OpenGL glColor3iv function does not work !
 
Hi. This is my program: #include <GL/glut.h> #include <stdlib.h> #include <time.h> #include <stdio.h> using namespace std; typedef struct _POINT { ...
[8 replies] Last: @xerzi: Thanks. I didn't know that. (by majidkamali1370)
by viliml
counting occurenes of values
 
In the last 24 hours there were 3 topics of people who had trouble counting occureces of a value in an array! I answered nicly in the firts one, less nicely in ...
[1 reply] : Just because multiple people have similar questions, isn't really a re... (by ResidentBiscuit)
how does operator new allocate memory?
 
It is known that the new operator in C++ allocates block of memory. But it seems that using the new operator to allocate an array of items allows us to use many...
[2 replies] Last: Thank you, Moschops. Your answer is really helpful! (by AndyTruong)
how would i change this so that player follows..
 
i am currently trying to get the player to follow the mouse in SDL, at the moment i am trying to change from using keys to move a player to the mouse but i'm no...
[1 reply] : You can use SDL_GetMouseState to get the mouse position. http://www.li... (by Peter87)
guaranty that vector wont free memory
 
Hi, I frequently write code that needs to over and over add elements to a vector and then erasing all the vector. Usually I know in advance an upper bound to ...
[13 replies] Last: [quote=Athar]push_back does not cause reduction of capacity when reser... (by Peter87)
Private accessing problem when overloading(friends)
 
I've never had this issue before, it's got to be a really simple mistake im missing here but i just cant figure it out. Here is the error report im getting: ...
[2 replies] Last: Try moving the stream overloads implementation into the header. Edit: ... (by naraku9333)
by ToniAz
Memory Accesses vs. FP Operations
 
Hello everyone! It's been a shocker to find out the hard way that complicated expressions that handle floating point operands take as much time to evaluate a...
[12 replies] Last: Yes, indeed, I could split it into two, and let the first of the two r... (by ToniAz)
by dancks
Need advice on game design
 
I have a single player, multiple enemies, one main weapon with 3 optional weapons to be picked up along the way (used by both player and enemy) I need to figure...
[1 reply] : Here's a thought: I can reduce space and clock and processor usage by ... (by dancks)
what is worng with this program, it wont start at 0?
 
this program is suppose to start at 0 and go through to the desired number, in this case 500. however it starts at 205 and then goes to 500. what gives??? s...
[4 replies] Last: It could be that your console buffer is not large enough to be able to... (by yoreei)
What packages to install for ncurses?
 
Okay, so I'm a total noob at everything to do with programming, seeing as I have only been using Linux for about 2 months, and don't know that much c++, but I h...
[2 replies] Last: Yup, that worked perfectly, thank you! And I meant *Ubuntu 12.04*, not... (by ptrlake2)
Crash after certain point
 
Hi so this is my first post, Im trying to type a function that will display a linked list. I dont have any errors but when I compile it and try to display the l...
[1 reply] : I expect you're trying to use a pointer that's not pointing to an acco... (by Moschops)
A lockless, single-producer/consumer ring-FIFO that won't run out of space
 
I'm very interested in the lockless single-producer-single-consumer multi-threading FIFO queue posited here, and referenced by a number of implementations: http...
[1 reply] : Your code is based on false assumptions. It will only work on some ve... (by Disch)
how to deal with more precise values?
 
Hello, i started working on variables that are more precise i.e. 3.25456987895787 * 0.0000059988565 But i cant find find any way to do calculation on this m...
[4 replies] Last: i want to set precision by myself. eg i=0.000094; j=56000; k=i+j; c... (by unkn00wn)
by thamsa
String rotation
 
hi im trying to rotate a sting to the right, example "tomorrow" to look like this: TOMORROW OMORROWT MORROWTO ORROWTOM RROWTOMO ROWTOMOR OWTOMORR WTOM...
[5 replies] Last: Thamsa says: hi im trying to rotate a sting to the right, example "to... (by Moschops)
learning
 
Hi everyone! I'm just 14 but I've always wanted to make my own program. Lately, I've decided to learn how to do so and I've come to realize that it is indeed a ...
[3 replies] Last: Yea, I'm 12(OK, in 4 days Im gonna be 13...), but look at my profile h... (by viliml)
Using Loop Statements Only..Help!
 
what is wrong with these???solving for a minimum and maximum #include <iostream> using namespace std; int main () { int a,b; cout<<"how many nos. you wan...
[5 replies] Last: I have 3 words for you: std::min_element and std::max_element! (by viliml)
Greedy Algorithm
 
I have the following given algorithm. Algorithm_Greedy(S) S1 <- S SOL <- (void) While (NOT STOP-Condition) Do x <- a local, optimal element from S...
[8 replies] Last: But I don't speak German... LOL, neither do I, but guess who does..... (by viliml)
July 2012 Pages: 1... 34567... 30
  Archived months: [jun2012] [aug2012]

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