General C++ Programming - September 2012 (Page 14)

Array/Vector access slow down
 
I recently converted a single *.cpp project file into two *.h files with corresponding *.cpp files(1 class each), and a main.cpp. I did not significantly change...
[6 replies] Last: @ KRAkatau : Vectors are contiguous, and believe it or not this actua... (by Computergeek01)
Calculastions
 
how would you write a code for 1. Use follow variable value double a=1.0; double b=3.0; double c=4.0; double d=2.0; double answer = 2.0; 2. Cre...
[3 replies] Last: So you don't need dark GDP for this? (by instantsting)
writing an assembly language program that corresponds to this C++ Program
 
I am trying to figure this out I am not familar with C++. #include <iostream> using namespace std; int num1; int num2; main () { cin >> num1 >> n...
[5 replies] Last: Thanks Computergeek01 good information i will try it and see Hans... (by nightraze)
Dereferencing char* pointer with an offset giving me segmentation faults.
 
I have a class in which a char* is a member of that class. I have initialized the members to "abcde". I am trying to use a member function that changes the casi...
[10 replies] Last: So you are saying that I should create another class where its member ... (by mothergoose729)
by RyanV
Memory Fragmentation in C
 
Hi, I am supposed to write a program in C that: Allocates memory for a sequence of 3m arrays of size 500,000 elements each. The program then deallocates ...
[3 replies] Last: The accuracy of QueryPerformanceCounter() is limited only by how much ... (by helios)
Big O notation
 
Could you please help me answering these three question 2) Write out code that prints out all pairs of numbers between 0 and 8. (e.g. 00, 01, 02, …, 86,...
[2 replies] Last: Write out the algorithm for doing this, and it'll be pretty obvious (by ResidentBiscuit)
by Eyad
2D array (Chess Knight)
 
The user suppose to pick a place on the chessboard and the program should give all the possible moves the knight can make. The If statement works only for numb...
[4 replies] Last: ty (by Eyad)
Pointers to member functions of classes
 
#include <iostream> #include <string> using namespace std; class Aircraft { public: Aircraft() : MPrice(0), LPrice(0), BPrice(0), PPrice(0)...
[12 replies] Last: That wasn't the original implementation. It was Aircraft::GetTotalPric... (by pogrady)
Assertion failed?
 
Hey everybody, i honestly have no idea what the problem could be with this one I keep getting sigabrt. I can draw bitmaps fine but sometimes it just crashes. It...
[6 replies] Last: Ok so at what iteration does it explode? What is and empty at the ... (by clanmjc)
Fix issue, compiles fine but random function is acting fishy
 
For opponent type, the code works, but for some reason it is coming out with mostly OpponentMonster1 (fire), and OpponentMonster3 (nature), and after compiling ...
[3 replies] Last: You need to initialize the seed only once. Do it in main or something... (by clanmjc)
Orbit mechanics
 
#define STAR_MASS 2000000 Asteroid::Asteroid() { x = (rand() % 10000) - 5000; y = (rand() % 10000) - 5000; mass = (rand() % 20) + 2; randDir = (r...
[4 replies] Last: Wow thanks. Your last point was exactly what I had in mind! If you get... (by closed account 2NywAqkS)
Error: nonstatic member must be relative to object
 
I'm writing the engine for a game and I'm getting to the part where I start drawing the map and giving textures to objects. But I can't seem to get past this on...
[5 replies] Last: Thank you so much! Everything works perfectly now! (by bakersix)
Linked Lists assingment
 
Hey there this is my first posting in this forum I have been having a horrible time doing this c++ assignment well most of the part is done I have four fi...
[1 reply] : Please use code tags <> (by Fransje)
interviews
 
i am a grad student, about to graduate soon and looking to study for interviews. As i was looking for books to study for interviews i came across a forum on sta...
[8 replies] Last: Thank you so much everyone....really appreciate it. (by babbarbhangoo)
Game of pig
 
The program is called Game of Pig I may have over thought it and made it to complex I tend to do this. Its a user verses the computer game first one to 100 wins...
[15 replies] Last: @ whitenite1. Thank you for all your help and for answering my questio... (by wyildcard)
Passing class object arrays to methods...
 
When I pass a class object array to a method say bookType books ; int bookIndex; //determines what element the object array books is by user i...
[3 replies] Last: But when you want to pass an array of a type, this is the syntax: Sor... (by pogrady)
How to send Skype messages with C++
 
Hello, so I made a program in AppleScript to send my friend a Skype message (and some friendly spamming :P) Anyways, I'll print the code. tell application "Sk...
[no replies]
Setting the value of a variable
 
Hi, I was wondering if Foo bar = *(new Foo()) is okay to do, or am I wasting memory because I cannot delete the the data from the heap after assigning the va...
[7 replies] Last: http://www.arkko.com/ioccc.html (by pogrady)
Don't Know where to begin
 
Hey, Im new to this forum but my tutor recomended I check this website out. I was just wondering if anyone could give me guidance on my current project. I have ...
[7 replies] Last: The code I posted can be used as framework. and e can be declared as ... (by IWishIKnew)
Functions of Structs
 
I was wondering if there was any way to make a function whose parameters can be a struct, such that any variable inside of the structure could be a valid parame...
[2 replies] Last: You can write a member function of the stracture that will do the task... (by vlad from moscow)
September 2012 Pages: 1... 1213141516... 32
  Archived months: [aug2012] [oct2012]

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