299 Posted Topics

Member Avatar for zhengcyy

See this line? `class War: public Game` You're declaring War to be a derived class of Game. See this line? `class TicTacToe` You're declaring TicTacToe to be a class of its own with no base class.

Member Avatar for DeanMSands3
0
402
Member Avatar for srinidelite

> if(arr1[j][0] == arr2[k][0]) This is not how to do string comparisons in C. http://www.cplusplus.com/reference/clibrary/cstring/strcmp/ When the two strings are the same, strcmp will return 0. There may be other bugs, but this is the one that stood out to me.

Member Avatar for DeanMSands3
0
146
Member Avatar for claywin

OK, claywin, we really can't help you the way you want us to. Not with the information we have. So here's what we're going to do: SDL_Rect rcSrc, rcPlayer; std::cout<<"Player object created!\n"; SDL_Init(SDL_INIT_VIDEO); std::cout<<"Video initialized!\n"; SDL_WM_SetCaption("Untitled", "Untitled"); std::cout<<"Caption set!\n"; screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); std::cout<<"Video Mode set!\n"; temp = …

Member Avatar for Labdabeta
0
1K
Member Avatar for Lucaci Andrew

In regards to your redundant **class X;**, remove them from the beginning of each header not counting **A.h**. You're including the header files so you don't need an additional **class** statement. In regards to the run-time error: yes, exactly. A pointer is not the object it points to. It's like …

Member Avatar for gusano79
0
712
Member Avatar for tomtetlaw

http://www.opengl.org/sdk/docs/man/xhtml/glGenTextures.xml >There is no guarantee that the names form a contiguous set of integers; however, it is guaranteed that none of the returned names was in use immediately before the call to glGenTextures.

Member Avatar for DeanMSands3
0
59
Member Avatar for SanRubik

Learn to read data in from files: http://www.bgsu.edu/departments/compsci/docs/read.html [http://cpp-tutorial.cpp4u.com/STL_ifstream.html](http://cpp-tutorial.cpp4u.com/STL_ifstream.html) http://www.cplusplus.com/doc/tutorial/files/ Learn dynamic memory allocation: http://www.cplusplus.com/doc/tutorial/dynamic/ http://www.yolinux.com/TUTORIALS/Cpp-DynamicMemory.html Use a nested **for** loop. Vote for Pedro.

Member Avatar for DeanMSands3
-1
137
Member Avatar for SAM2012

Well, there are a couple of things you can do. You can poll the queue repeatedly, checking to see if it's not empty. void someFunction(){ while(1){//Loop forever. if(myQueue.Empty()==false){ doSomethingAmazing(myQueue.popFront()); } } } This is kind of wasteful. Or you can put in an observer-relationship. You create an observer object list …

Member Avatar for DeanMSands3
0
190
Member Avatar for haris riaz

EDIT: Labdabeta beat me to it! I spent so much time on this one! Darn the luck! I'd suggest a recursive function with a backtracking mechanism like a stack or a double-ended queue. deque<yourClass> *myRecursiveFunction(vector< vector< yourClass > > *dataSet){ deque<yourClass> *dataSelected=new deque<yourClass>(); if(myRecursiveInnerFunction(currentDataSet, 0, dataSelected)) return dataSelected; else return …

Member Avatar for histrungalot
0
163
Member Avatar for DeanMSands3

I need GMPXX on MinGW. This is driving me nuts. EDIT: I should mention I've tried using the precompiled MinGW GMP and GMPXX libraries via the **mingw-get**. And they fail. I removed them. I compiled GMP in MSYS with the following line. ./configure --enable-cxx --prefix="/mingw" && make && make install …

Member Avatar for DeanMSands3
0
623
Member Avatar for suhasgh

@Lerner: Actually, suhasgh's right. The **delete** kills the object instance, but the **erase** deletes the lingering pointer kept in memory. However, I'm curious about the erase statement and if it's killing the right entry each time. As far as the **for** loop that cleans up, I'd yank the erase. Then …

Member Avatar for DeanMSands3
0
237
Member Avatar for Suzie999
Member Avatar for Labdabeta

Props to nezachem. I was going to suggest the same thing. Did a little research on some broadcast tuts and learned that APPARENTLY broadcast is dead, long live multicast. Huh. http://lmgtfy.com/?q=winsock+multicast+example Also, don't forget that with any WinSock program you write, you'll need to link in the appropriate library for …

Member Avatar for Labdabeta
0
224
Member Avatar for Brasa619

OK, explain this bit. slen = (unsigned) strlen(keyPtr); slen2 =(unsigned) strlen(keyPtr2); if( strlen(slen) == NULL && strlen(slen2) == NULL) { fprintf(stderr, "\n\tNo keys entered. You must enter 2 keys.\n"); error = 1; } if(strlen(slen2) == NULL) { fprintf(stderr, "\n\tOnly 1 key entered. You must enter 2 keys.\n"); error = 1; …

Member Avatar for DeanMSands3
0
183
Member Avatar for TheFearful

Two thoughts on this one. A. Use [memmove](http://www.cplusplus.com/reference/clibrary/cstring/memmove/) (which allows source/destination overlap) to relocate the values like so: memmove(&data[51],&data[50],49*sizeof(int); data[50]=42; B. Use a for loop that works backwards. for(int i=99;i>50;i--){data[i]=data[i-1];} data[50]=42; Frankly, the second should have been a little obvious.

Member Avatar for DeanMSands3
0
117
Member Avatar for dan1992

First, here's a tutorial on pointers: /* ============================================================================ Name : PointersExplained1.c Author : Dean M. Sands, III Version : 0.1a Copyright : I will set fire to the flamingos in your front yard. Description : A code explanation of pointers ============================================================================ */ #include <malloc.h> #include <stdio.h> #include <conio.h> int *i; …

Member Avatar for dan1992
0
170
Member Avatar for DeanMSands3

I'm using the 620 WinLoader software that ties to an ancient Honeywell LM 620-25/35. And I've gotten it to work in a one-to-one connection with an RS422 USB adapter. (After lots of rewiring cables.) Now the tricky part. I've got a coworker who wants to remote into a single box …

Member Avatar for DeanMSands3
0
265
Member Avatar for hwoarang69

Your code is already to go really. Just make these changes: /* Read lines from input file */ while(fscanf(finp, "%s", line) != EOF) { insert(head, line); } void insert(struct tree_node *head, char *li) { if(head == NULL) { head = (struct tree *)malloc(sizeof(struct tree_node)); if(head == NULL) { printf("Node allocation …

Member Avatar for DeanMSands3
0
124
Member Avatar for Griff0527

The Compiler is expecting you to use a Class object with those functions unless you declare them as static. In your header, put [B]static[/B] in front of the declarations (i.e. right before the word [B]void[/B]), but not in the implementation.

Member Avatar for raptr_dflo
0
377
Member Avatar for shean1488

I'm not entirely sure what you're trying to accomplish with the squeeze function. I will tell you this: Instead of [CODE]for(i=0; i<s1; i++) {[/CODE] you probably want [CODE]for(i=0; i<strlen(s1); i++) {[/CODE] strlen requires [B]string.h[/B], not to be confused by the C++ [B]string[/B] header.

Member Avatar for zeroliken
0
98
Member Avatar for prasenjit_das

Any modern compiler will work for you. That said, I recommend starting out with Code::Blocks. [url]www.codeblocks.org/[/url] While this isn't the biggest and the best, it's one of the easier methods. For Graphics, you will want to use DirectX, OpenGL, Allegro, SDL or SFML. The easiest is SDL. [url]http://wiki.codeblocks.org/index.php?title=Using_SDL_with_Code::Blocks[/url] When you've …

Member Avatar for DeanMSands3
0
2K
Member Avatar for dlmagers

[CODE]If the input for the gender doesn't match 'F' and doesn't match 'M' complain and exit. if(gender!='F'&&gender!='M'){ cout<<"Invalid Gender."<<endl; return 0; } If the input for the activity doesn't match 'I' and doesn't match 'A' complain and exit. if(level!='I'&&gender!='A'){ cout<<"Invalid Activity Level."<<endl; return 0; }[/CODE]

Member Avatar for DeanMSands3
0
143
Member Avatar for Chuckleluck

[LIST] [*]Use "Product Activation" [*]Use a web-installer with a server that generates content encrypted for that machine only. [*]You don't. [/LIST] Happy coding.

Member Avatar for Ketsuekiame
0
195
Member Avatar for kmlilo

This will get you started. [CODE] #include <iostream> using namespace std; string studentName[10]; float studentMark[10]; char studentGrade[10]; char getGradeByMark(float mark){ int iMark=(int)(mark/10); switch(iMark){ case 10: case 9: return 'A'; case 8: return 'B'; case 7: return 'C'; case 6: return 'D'; default: return 'F'; } } void getStudentData(int student){ cout<<"Input …

Member Avatar for DeanMSands3
0
197
Member Avatar for ads1188

[url]http://www.daniweb.com/software-development/cpp/threads/341509[/url] Props to AD for this one. I upvoted his post. You should do the same.

Member Avatar for ads1188
0
113
Member Avatar for franmaez_0716

Are you running Windows, Mac, or Linux? If Windows, are you using Visual Studio, NetBeans, Eclipse, Dev-C++ or Turbo C++?

Member Avatar for franmaez_0716
0
2K
Member Avatar for Z33shan

Maybe you mean ellipse? [url]http://msdn.microsoft.com/en-us/library/6hkxb3kd(v=vs.80).aspx[/url]

Member Avatar for Ancient Dragon
0
579
Member Avatar for capton

To what platform or format? If you're talking about to the console, eh, you're going to have to write a function that generates an array of multiple lines and offsets the sub and super script text to their corresponding position in the main line of text. For example: [CODE] n …

Member Avatar for DeanMSands3
0
415
Member Avatar for mBrissman

You only have pointers. The memory space isn't allocated yet. If you were using arrays, that'd be different. [CODE] struct Adress{ char street[32]; char postal[32]; int zip; }; struct Person{ char firstName[32]; char lastName[32]; struct Adress home; }; [/CODE] EDIT: This might be helpful. [URL="http://www.cs.stanford.edu/cslibrary/PointerFunCBig.avi"]Stanford Explains Pointers.[/URL]

Member Avatar for mBrissman
0
1K
Member Avatar for ADHDinIT

ADHD in IT? No, but definitely ADD. What do I avoid? Anything involving backing up and making system-generic images for. Not that I get out of it, mind you.

Member Avatar for daniel.walker01
0
153
Member Avatar for free2move

You can't use arrays? Can you use linked lists or trees? EDIT: How did we all reply at the same time?

Member Avatar for free2move
0
2K
Member Avatar for rohan121212

What version of Allegro are you using? That looks like older Allegro code. Allegro 5 uses a whole new API. I compiled Allegro 5 on my system using MSYS, MinGW and CMake. Then I tried compiling that code. Didn't take. Tried code from the Wiki. Worked without any problem.

Member Avatar for DeanMSands3
0
88
Member Avatar for CityThrille

Look into cross-platform libraries. I like SFML. Unfortunately version 2 isn't finished yet. SDL has been around forever and a day. It has a nice community following. There are others. Google is your friend. Happy coding.

Member Avatar for BCBTP
0
255
Member Avatar for Karlwakim

Scripting engines and graphics loading, saving & manipulations. See if you can take a script, some single frame sprites, background tiles, and generate a single scene. Export it to JPEG or PNG. Heh, I need to try that.

Member Avatar for jbennet
0
90
Member Avatar for Graphix

[CODE]long fileSize; fseek(input, 0L, SEEK_END); //Go to end of file fileSize = ftell(input); //Current position is the file length rewind(input); //Rewind to beginning[/CODE] Then just do a [B]for[/B] loop. As for speed, your fgetc is killing you. Single character reads is too slow. Once you know your file size, [B]malloc[/B] …

Member Avatar for Graphix
0
2K
Member Avatar for cutterpillow20

No. But I will give you this. [CODE] #include <stdio.h> int main() { int i; char oneDimensional[]="I am one-dimensional!\n"; char twoDimensional[5][5]={ "I am", {'t','w','o','-',0}, "dime", "nsio", "nal!" }; printf("%s",oneDimensional); for(i=0;i<5;i++){ printf("%s",twoDimensional[i]); } return 0; } [/CODE] Which outputs this: [CODE]I am one-dimensional! I amtwo dimensional![/CODE] Yes, I know it's missing …

Member Avatar for cutterpillow20
0
366
Member Avatar for travelingt93

Allow me to make some adjustments. [CODE]#include <iostream> #include <string> #include <vector> #include <cstring> #include <cstdlib> using namespace std; class ship { char Name[256]; vector<string> inventory; public: void setName(char *nam) { strcpy(Name, nam); cout << Name; } void addToInventory(string frt, string sec, string thir) { inventory.push_back (frt); inventory.push_back (sec); inventory.push_back …

Member Avatar for Ab000dy_85
0
209
Member Avatar for Abhineet.Ayan

Are you giving QUWI enough time to finish? It looks like you're queuing the thread, then exiting. Have a look at this: [url]http://developer.amd.com/documentation/articles/pages/125200687.aspx[/url] In this code, when the last thread finishes, it signals an event, which the main function waits for before exiting.

Member Avatar for DeanMSands3
0
642
Member Avatar for student_learner

A char tends to be 8 bits. An int on a 32-bit machine is 32-bits. If an int contains a 2, it actually contains {2,0,0,0} (in a 32-bit system) Try this code: [CODE]#include<stdio.h> int main() { unsigned int i, j; int arr[3]={2,3,4}; char *p; // p = (char*)arr; // line …

Member Avatar for DeanMSands3
0
233
Member Avatar for DeanMSands3

We have 32 data gathering sources all operating at 100Mb. They tie to a single server. Currently, we're using a 100 Mb network. We've have 2 Trendnet TEG-424WS units we can put in. They come with 24x100Mb ports and 4x1Gb uplinks. Can we tie the server to one of the …

Member Avatar for CimmerianX
0
141
Member Avatar for arold10

Floats and Doubles see the world much differently than integers do. Do an is it equal to...? will probably have some weird results. My advice, change it to [B]while(!(hoursWorked<0))[/B] Reference: [url]http://en.wikipedia.org/wiki/IEEE_754-2008[/url]

Member Avatar for arold10
0
201
Member Avatar for jonnyboy12

Have you set up port forwarding on your router? Secondly, have you tried accessing your server from a computer outside your local network - like a laptop at an internet cafe. Reference: [url]http://en.wikipedia.org/wiki/Port_forwarding[/url] [url]http://portforward.com[/url]

Member Avatar for DeanMSands3
0
244
Member Avatar for predator78

Compiled in MinGW under Eclipse without changing any linker settings. Ran fine for me. What compiler are you using? (And where did you get it?)

Member Avatar for jbennet
0
233
Member Avatar for juce

Read this code, then fix it. [CODE] #include <string> #include <iostream> using namespace std; int main(){ string s1="123"; //Set up string 1 string s2="456"; //Set up string 2 string s3; //Setup string 3 cout<<"First string: "<<s1<<endl; cout<<"Second string: "<<s2<<endl; s3=s1; //Copy string 1 into string 3 for(int i=0;i<s2.size();i++){ //Loop through …

Member Avatar for mazzica1
0
1K
Member Avatar for jonnyboy12

Absolutely. Write a socket server. Then write a chat server and client. When you get finished with that you will wonder why I told you to. Then it will suddenly become obvious. [url]http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin[/url] [url]http://www.codeproject.com/Articles/14032/Chat-Client-Server[/url]

Member Avatar for jonnyboy12
0
157
Member Avatar for sfurlow72

[QUOTE]...at what point do you start to learn the more advanced stuff?[/QUOTE] When your professor's first spoken language is not the same as your own. That's when you get into the crazy stuff.

Member Avatar for sfurlow72
0
175
Member Avatar for lxXTaCoXxl

Something's wrong somewhere and I'm not entirely sure where. It seems like it SHOULD WORK, but SHOULD WORK rarely works the way it should. Have a look at this: [url]http://en.wikipedia.org/wiki/Equations_of_motion#Applications[/url] (I don't know why they picked the variables they did, but they did.) A free fall object at point [B]s[/B] …

Member Avatar for DeanMSands3
0
868
Member Avatar for anurag awasthi

A moving average would look like this: Average = 0.0 (Use doubles) Number of elements = 0.0 Total = 0.0 While there are more numbers: Ask for a new number. Add new number to total. Add 1 to number of elements. Divide total by number of elements. Store in average. …

Member Avatar for DeanMSands3
0
185
Member Avatar for yongj

This is a poorly made list, but I was (am) in a hurry. 0.a. Arrays 0.b. Pointers as arrays 0.c. Pointers to Pointers 0.d. Pointers to Pointers as Arrays of Arrays (I learned Pointers by using Iceman's C rewrites of Denthor's VGA trainers.) 1. Stacks as arrays 2. Double-Ended Queues …

Member Avatar for Kanoisa
0
121
Member Avatar for razes_0230

Here, let me google that for you: [url]http://www.codeproject.com/Articles/24684/How-to-create-Linked-list-using-C-C[/url]

Member Avatar for Lerner
0
346
Member Avatar for DeanMSands3

[url]http://www.cs.stanford.edu/cslibrary/PointerFunCppBig.avi[/url] Main Page Link: [url]http://cslibrary.stanford.edu/104/[/url] (If this helpful to anyone, it is technically not trolling.)

0
68

The End.