Search Results

Showing results 1 to 35 of 35
Search took 0.01 seconds.
Search: Posts Made By: Evan M
Forum: C++ Mar 11th, 2009
Replies: 4
Views: 232
Posted By Evan M
sqrt() requires a double, float, or long double as a parameter. Judging by your variable name, you're attempting to pass an int to sqrt(). Try using static_cast to convert it to a double like so:
...
Forum: C++ Mar 10th, 2009
Replies: 4
Views: 539
Posted By Evan M
Thanks for the help. I always assumed since the constructor isn't virtual, the destructor wouldn't have to be either. The memory leaks are gone :)
Forum: C++ Mar 10th, 2009
Replies: 4
Views: 539
Posted By Evan M
I'm having several difficulties with memory leaks in a program (I've been using "Visual Leak Detector" to check for memory leaks). I've simplified the code to the following:

#include "vld.h"...
Forum: C++ Oct 28th, 2008
Replies: 5
Views: 356
Posted By Evan M
Rather than having YesorNofunc() call another function, it would probably be easier to have it return int. You could declare two constants (or use #define) YES and NO. Then whenever you need a yes or...
Forum: C++ Oct 24th, 2008
Replies: 10
Views: 960
Posted By Evan M
After creating the Win32 Console Application project, there should be a window that says "Win32 Application Wizard". Click "next" and click the "Empty Project" checkbox.
Forum: C++ Oct 24th, 2008
Replies: 10
Views: 960
Posted By Evan M
Win32 Console Application.
Forum: C++ Oct 24th, 2008
Replies: 10
Views: 960
Posted By Evan M
Under "Build", click "Build Solution", or just hit F7.

If there is no "Build" in the menu, then you need to create a project first. Click File->New->Project.
Forum: C++ Oct 24th, 2008
Replies: 3
Views: 815
Posted By Evan M
I think your problem is with cin. Using cin >> somevar followed by getline() will cause a few problems. Putting cin.ignore( 1024, '\n' ) before getline usually works for me. You will probably want to...
Forum: C++ Oct 24th, 2008
Replies: 3
Views: 815
Posted By Evan M
Try shrinking your code to what is relevent to your problem. No one is going to try reading through ~700 lines.
Forum: C++ Oct 23rd, 2008
Replies: 7
Views: 1,354
Posted By Evan M
That needs to be == 0 instead of == 1.
Forum: C++ Oct 23rd, 2008
Replies: 7
Views: 1,354
Posted By Evan M
Your problem with the "ambiguous overload for operator in cin >> variable" is caused because variable was declared as const. When you declare something as a const, it cannot be changed. Since a const...
Forum: C++ Oct 22nd, 2008
Replies: 2
Views: 836
Posted By Evan M
You don't need to declare Q and q as chars to use 'Q' and 'q'. You also have an unreferenced variable (ie, a variable you declared but never used).

Take a closer look at the logic in the while...
Forum: C++ Oct 22nd, 2008
Replies: 4
Solved: Inline question
Views: 393
Posted By Evan M
Thanks for the help.
Forum: C++ Oct 22nd, 2008
Replies: 4
Solved: Inline question
Views: 393
Posted By Evan M
As I was busy inlining some of my functions, I was wondering if it is really necessary to inline anything. Doesn't the compiler automatically inline stuff, or do I have false memories? And if the...
Forum: C++ Oct 11th, 2008
Replies: 2
Views: 1,311
Posted By Evan M
I believe you mean CLoadObj* g_LoadObj = gcnew CLoadObj;
Forum: C++ Oct 11th, 2008
Replies: 4
Views: 397
Posted By Evan M
I think the problem is with the constructor. You either need to add parameters matching the class constructor in the line Mortgage myMortgage(); or make a default constructor with no parameters.
...
Forum: C++ Oct 11th, 2008
Replies: 5
Views: 501
Posted By Evan M
Well, I messed around with my code for a few hours, and I discovered that it wasn't actually a problem with the vector (as always, I blamed the other code first). The problem is by the time the...
Forum: C++ Oct 10th, 2008
Replies: 2
Views: 970
Posted By Evan M
The easiest would probably be Simple Directmedia Layer, found here: http://www.libsdl.org/
Forum: C++ Oct 9th, 2008
Replies: 11
Views: 1,485
Posted By Evan M
Forum: C++ Oct 9th, 2008
Replies: 2
Solved: Help plz
Views: 321
Posted By Evan M
For file operations, look up the fstream (http://www.cplusplus.com/reference/iostream/fstream/) header. The basic code looks something like this:

#include <fstream>

using namespace std;

int...
Forum: C++ Oct 9th, 2008
Replies: 39
Views: 2,664
Posted By Evan M
Try re-examining the flow of your program. Think as the compiler: go line by line and ask "What is happening here?"

If you do not understand something in your code, I recommend you look it up on...
Forum: C++ Oct 9th, 2008
Replies: 5
Views: 501
Posted By Evan M
The problem with that approach is how my function works. Each time the program needs to display text, it calls renderText(). Loading a font takes my computer about 3 milliseconds, and I'm already...
Forum: C++ Oct 9th, 2008
Replies: 5
Views: 501
Posted By Evan M
I used resize instead of push_back because push_back requires that you put in a value. If I were to declare another instance of Font, set all the variables, then use that in push_back(), it is my...
Forum: C++ Oct 9th, 2008
Replies: 5
Views: 501
Posted By Evan M
I have a vector array of a class that's giving me some crap. I would beat it up, but that might result in some innocent circuits getting damaged.

Class:
class Font {
public:
Font();
...
Forum: C++ Aug 24th, 2008
Replies: 10
Views: 1,317
Posted By Evan M
Here's the code I wrote for retrieving stuff in the buffer. It works at first, but later on it keeps reading the same thing over and over. From what I gathered on MSDN, recv should flush the buffer...
Forum: C++ Aug 24th, 2008
Replies: 10
Views: 1,317
Posted By Evan M
The largest problem is that winsock appears to be appending data to the end of the buffer, in which case, how am I supposed to read the end of the buffer? It is also appending garbage data, which I...
Forum: C++ Aug 23rd, 2008
Replies: 10
Views: 1,317
Posted By Evan M
I'm creating a multiplayer game using winsock, but I've been having several problems with winsock. I've been searching for an alternative to it, but I haven't found anything. If anyone could point...
Forum: C++ Jul 19th, 2008
Replies: 4
Views: 726
Posted By Evan M
Thanks, these are much better ways than what I had before.
Forum: C++ Jul 19th, 2008
Replies: 4
Views: 726
Posted By Evan M
I've been getting an "Access Violation" error while running this program:

#include "SDL/SDL_ttf.h"

class Font
{
private:
TTF_Font *font;

public:
Forum: C++ Jul 9th, 2008
Replies: 3
Views: 1,478
Posted By Evan M
Thanks, it compiles now.
Forum: C++ Jul 9th, 2008
Replies: 3
Views: 1,478
Posted By Evan M
I have a header file causing me several errors. It contains a class definition, then I have a *.cpp file with the function definitions.

Header:
#ifndef DOT_H
#define DOT_H

#include...
Forum: C++ Jul 3rd, 2008
Replies: 8
Views: 829
Posted By Evan M
Thanks for the help guys. I knew it was something stupid.
Forum: C++ Jul 3rd, 2008
Replies: 8
Views: 829
Posted By Evan M
That code compiled for me as well, but I'm still having problems. I created a new project and changed the compiler settings a bit to include the SDL library, then put in the code:
#include...
Forum: C++ Jul 3rd, 2008
Replies: 8
Views: 829
Posted By Evan M
Your code worked for me too, so I replaced the '->' with '.', but was still getting an error. I was messing around with my code for a while, and finally found that replacing the CLIP_MOUSE stuff...
Forum: C++ Jul 2nd, 2008
Replies: 8
Views: 829
Posted By Evan M
I have a function which takes an array of SDL_Rect (which is a data structure containing four integers, x, y, h and w), and assigns values to the data members. However, when I try to compile, each...
Showing results 1 to 35 of 35

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC