General C++ Programming - December 2014 (Page 4)

Comparing two floats ranges?
 
Hello I'm trying to compare two float ranges and it seems to be a hit and miss. I'm trying to use a object origin and dimensions comparing it to another set fo...
[12 replies] Last: Seems fine to me. The same logic, re-factored into functions: #inc... (by JLBorges)
do while loops
 
I haven't done to much with do while loops but i want this do while loop to end when either the players health = 0 or alien health = 0 do { } whi...
[2 replies] Last: thank you so much (by mercedec)
ACAII Camera
 
I am currently creating an ASCII based 2d console game as a side project. Currently it works but I am trying to make the camera follow you. Does anyone know a ...
[1 reply] : Here is my current map draw code but it needs to be able to center on ... (by lordseanington)
3D Text Based Game
 
I know this may sound stupid, but I want to make a text based 3D game. I mean making it styled to look like its 3 Dimentional. I understand it may sound stupid ...
[14 replies] Last: Thank you, it does currently work now and I thank you all. (by lordseanington)
Random array filling of airline seating assignment
 
int firstarray = { }; double firstClass(int airplane, int seats, double price) {cout<<setw(60)<<"---------------------... cout<<setw(60)<<"You are in **...
[no replies]
by Jun77
structure function
 
I'm writing a function that compares two fraction. if the fractions are equal it returns 0. If the fraction in the first parameter is less than the fraction in ...
[2 replies] Last: thx alot JLBorges. now i am cleared . (by Jun77)
Why is this '\n' causing a run time error?
 
#include <iostream> #include <cstring> void replace_substring(char *, char *, char *); int main() { const int SIZE = 50; char str1 = "the dog ...
[2 replies] Last: As Zhuge said. See for yourself: void replace_substring(char * stri... (by MiiNiPaa)
Unknown logic error, simple program
 
#include <iostream> #include <string> #include <cctype> using namespace std; const int MIN_CHARS = 6; void get_password(); void verifyPassword(string...
[2 replies] Last: Thank you so much MiiNiPaa I see you on here helping all the time your... (by MarkyMark)
Need help with error program gives segment fault core
 
Program keeps giving me a segemntation fault error #include<iostream> #include<string> using namespace std; string reverse(string word, int size, stri...
[6 replies] Last: Hi, Just a couple of minor things to add: Don't have using namespac... (by TheIdeasMan)
How can I use a string to create a class object?
 
I wanted to create a new class object and I want to name it from a string. Something like this: string name = "Mike"; Customers name; //to create a new objec...
[11 replies] Last: Something along these lines: struct info { explicit info( std::s... (by JLBorges)
cross-platform C++ compilation
 
Sorry if this belongs in the newbies forum and the moderator should feel free to move it there if needed. No hard feelings either way. I wrote a simple pract...
[3 replies] Last: Yes. There is. Google for something like cross compilation to windows... (by MiiNiPaa)
VisualStudio is making slow programs!
 
I've wrote an algorithm for threaded IntroSort. I use winapi for threading. I've developed it using CodeBlocks and it's pretty fast, but when I take the same...
[4 replies] Last: Yea, that example has very different execution times, but you used a l... (by zoran404)
General Question
 
Hello everyone! I am lately doing some "thinking" C++ problems at Euler and other sites. My question was: what is the best method to solve all this problems? I...
[4 replies] Last: Thank you very much for clarifying this to me, really thankful. Delsh (by Delshire)
Tag dispatching constructors
 
#include <iostream> #include <string> struct A { struct Tag{}; std::string name; int value; A (const std::string& n, int v) : name(n), value(v) {} A (con...
[2 replies] Last: #include <iostream> #include <string> #include <utility> struct A { ... (by JLBorges)
violating strict weak ordering std::sort
 
Getting the common segfault with this operator function (the function is really simple. It's just this long because it repeats some conditions.): bool operato...
[5 replies] Last: I'm not understanding, you consciously created a not strict weak orde... (by ne555)
Prime Number
 
/*Hi everybody This shows any prime number between a and b and also counts them*/ #include <iostream> using namespace std; int main(){ int a; int...
[1 reply] : "cout << "\nenter the first Number : " ;" There is a typo, pal. Assumi... (by CPlahPlahLearner)
Pixelating an image
 
Hi guys, I've been struggling with this for a few days now. My assignment is to pixelate an image based on users input. I have a structure that stores the ima...
[1 reply] : You have to treat edges specially -- they should be 'infinite' -- when... (by Duthomhas)
minGW Segment Fault question
 
hi, using minGW 4.7.1 and getting a Segment Fault on exit from application. The fault occurs on a destructor of my main data structure. I find that when I add...
[1 reply] : It'd help if we could see the code in question. It's unlikely that any... (by Albatross)
Sniff packets on machine connected by wi-fi
 
I've coded a packet sniffer using raw sockets and promiscuous mode and recv() function to capture packets. It works fine on one machine, but captures only incom...
[4 replies] Last: That's an interesting article, but it leaves me a bit confused. I don'... (by Clint Westwood)
by Neber
Pointer passed to function value doesn't change
 
For some reason when i pass a string pointer to a function such as string *str = new string(""); and pass that string to a handleElement() function e.g. handl...
[2 replies] Last: it simply doesn't change when the function exits as though it's passi... (by MikeyBoy)
December 2014 Pages: 123456... 31
  Archived months: [nov2014] [jan2015]

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