Posts
 
Reputation
Joined
Last Seen
Ranked #4K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
1
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
0 Endorsements
Ranked #2K
~5K People Reached
Favorite Forums
Favorite Tags
c++ x 42

23 Posted Topics

Member Avatar for Evan M

I've been messing around with c++ and attempting to fully understand certain behaviors. Given the following program: [code=C++]#include <iostream> class Test { public: Test(); ~Test(); void func(); }; Test::Test() { std::cout << "Constructor" << std::endl; } Test::~Test() { std::cout << "Destructor" << std::endl; } void Test::func() { std::cout << "Deleting …

Member Avatar for Evan M
0
113
Member Avatar for moods125

'Char' is not a valid C++ type. 'Num' function does not match its prototype (see lines 23 and 58). 'Num', if ever executed, will never execute lines 66-77; enclose your 'if' statements in braces and you should find the answer. Match all opening braces ( '{' ) with closing braces …

Member Avatar for moods125
0
273
Member Avatar for neumannj656

When you add the semicolon, that is the scope of the loop. [icode]while (true) {this stuff executes} [/icode] [icode]while (true); {this stuff never executes}[/icode] The semi-colon is terminating the scope of the loop before it executes the stuff inside the braces. The same applies for 'if' and 'for'.

Member Avatar for Evan M
0
158
Member Avatar for DawnOfIkaros

Try changing SDL_SURFACE to SDL_Surface. Also, for ease of use, you might try dumping the SDL headers into your IDE's header folder - a wee easier than typing that long string per source file.

Member Avatar for DawnOfIkaros
0
118
Member Avatar for joed13k1941

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 [url]www.cplusplus.com[/url]

Member Avatar for collegetextbook
0
303
Member Avatar for WesFox13

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: [code=C++]cout << "The square root of " << num << " is " << sqrt(static_cast<double>(num)) …

Member Avatar for WesFox13
0
91
Member Avatar for 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: [code=C++]#include "vld.h" #include "vldapi.h" #include <string> #include <vector> class BaseFoo { public: BaseFoo() {} ~BaseFoo() {} }; class ButtonFoo { public: void …

Member Avatar for Evan M
0
174
Member Avatar for Xarver

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 no answer, you could use an if/else statement: [code=c++] const int YES = 1; const …

Member Avatar for Xarver
0
147
Member Avatar for StephanJos

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.

Member Avatar for tonief
0
163
Member Avatar for kahad

[quote=Read This Before Posting]Keep the code short and sweet! As much as we don't care, people insist on posting pages and pages of irrelevant code. Keep the code as short as possible. If the code isn't short, make it short by cutting out as much irrelevant code as possible. Ideally, …

Member Avatar for Evan M
0
122
Member Avatar for Shanebear

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 [U]cannot be changed[/U]. Since a const variable cannot be changed, cin cannot write any data to it. You'll also have a problem …

Member Avatar for Evan M
0
115
Member Avatar for grisha83

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 loop. It won't execute as you intended. It will always be …

Member Avatar for Evan M
0
142
Member Avatar for 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 compiler does inline stuff for me, would it be best to let it do its …

Member Avatar for Evan M
0
135
Member Avatar for pat7047

I think the problem is with the constructor. You either need to add parameters matching the class constructor in the line [icode]Mortgage myMortgage();[/icode] or make a default constructor with no parameters. It's the same problem as this: [code=C++]#include <iostream> using namespace std; class MyClass { public: MyClass( int a ); …

Member Avatar for ArkM
0
112
Member Avatar for yu83thang

[QUOTE=yu83thang;710009] Below is my declaration a Class in window form application, and the error was stated as below: CLoadObj^ g_LoadObj = gcnew CLoadObj; [/QUOTE] I believe you mean CLoadObj* g_LoadObj = gcnew CLoadObj;

Member Avatar for yu83thang
0
244
Member Avatar for avillachandok
Member Avatar for 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: [code=c++]class Font { public: Font(); ~Font(); int style; int ptSize; std::string name; TTF_Font *font; }; Font::Font() { style = TTF_STYLE_NORMAL; ptSize …

Member Avatar for Evan M
0
102
Member Avatar for Randomppl

For file operations, look up the [URL="http://www.cplusplus.com/reference/iostream/fstream/"]fstream[/URL] header. The basic code looks something like this: [code=c++]#include <fstream> using namespace std; int main() { fstream file; file.open( "whatever.whatever" ); // Check to make sure the file is open with file.is_open() // Read data line by line using file.getline(); works just like …

Member Avatar for Randomppl
0
70
Member Avatar for dmanw100

The easiest would probably be Simple Directmedia Layer, found here: [url]http://www.libsdl.org/[/url]

Member Avatar for dmanw100
0
102
Member Avatar for 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 me to something I could use in place of winsock (a free something), I would greatly appreciate it.

Member Avatar for dmanw100
0
585
Member Avatar for Evan M

I've been getting an "Access Violation" error while running this program: [code=c++]#include "SDL/SDL_ttf.h" class Font { private: TTF_Font *font; public: Font() { font = TTF_OpenFont( "c:\\windows\\fonts\\cour.ttf", 20 ); } ~Font() { TTF_CloseFont( font ); //Access violation } }; int main( int argc, char *args[] ) { if( TTF_Init() < 0 …

Member Avatar for Evan M
0
236
Member Avatar for 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: [CODE]#ifndef DOT_H #define DOT_H #include "SDL/SDL.h" #include <vector> class Dot { private: int x, y; int xVel, yVel; vector<SDL_Rect> box; bool check_collision( vector<SDL_Rect> &A, vector<SDL_Rect> …

Member Avatar for Evan M
0
521
Member Avatar for 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 line generates the error "error C2059: syntax error : '='". [CODE] int main() …

Member Avatar for Evan M
0
604

The End.