Posts
 
Reputation
Joined
Last Seen
Ranked #271
Strength to Increase Rep
+11
Strength to Decrease Rep
-2
93% Quality Score
Upvotes Received
106
Posts with Upvotes
98
Upvoting Members
78
Downvotes Received
8
Posts with Downvotes
7
Downvoting Members
7
34 Commented Posts
~262.22K People Reached
Favorite Tags

419 Posted Topics

Member Avatar for din_hilmi

I wrote something for this and if you want to put in more numbers its really easy (not as easy if you would just use arrays) if you read the code and see what I'm doing. [CODE]#include <iostream> using namespace std; int main() { int n1, n2, n3, n4, n5, …

Member Avatar for Aditya_47
0
44K
Member Avatar for daniel955

Here is a method using recursion that you could use. If you would want this to work with rocket mania then you would need to do checking to see if the two pipes line up rather than just replacing the character like the function does below. [CODE=C++]#include <iostream> #include <cstdlib> …

Member Avatar for Nisa_1
0
536
Member Avatar for restrictment

Would look more like a circle if the characters were square and line spacing was the same as character spacing. [CODE]#include <iostream> using namespace std; int main() { double r = 1.2; for( double y = -r-0.1; y <= r+0.2; y += 0.1 ) { for( double x = -r-0.1; …

Member Avatar for CharlieCap
2
2K
Member Avatar for nightcrew

This sounds like a trick question to me because if n was 50 or something and I gave the input 20, 30, 21, 49, 1, 35, ... 0 how would you be able to sort that without having a variable for each input. To "sort" a bunch of input in …

Member Avatar for omgerg
0
3K
Member Avatar for PulsarScript

You can use `System.IO.Directory.GetFiles(DIRECTORY_NAME);` which will return an array of strings that contain all the files (with full path) in that folder.

Member Avatar for sfuo
0
203
Member Avatar for choconom

I am not a Unix/Linux user so I am not 100% sure but after reading [on GetOpt here](http://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html#Using-Getopt) and [a GetOpt example here](http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html#Example-of-Getopt) I would say the short answer is you must write `myprogram.c -t file1 file2 file3` because it parses for options first.

Member Avatar for rubberman
0
180
Member Avatar for CJMW

I know this is a bit late and you may have come up with a solution already but here is a method you could use. pbGameBox is a PictureBox object from the C# Toolbox. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; …

Member Avatar for sfuo
0
2K
Member Avatar for andrew mendonca

Line 18 of what you posted makes no sense. It will always select maximum = maximum in the trinary operator and you cannot declare a variable equal to an undeclared variable (even if you could it would be holding a garbage value). Line 19 you are now saying that the …

Member Avatar for sfuo
0
408
Member Avatar for gangsta gama

I would suggest that you do not try to store all your information in labels, but rather have seperate variables that control the amount of each stat that your character has and then display those values in the labels. I tossed together a quick example of how you can use …

Member Avatar for gangsta gama
0
383
Member Avatar for glao

Not sure why you are switching values in the b array or why your swap function uses loops. #include <iostream> using namespace std; int main() { const int N = 3; double *a = new double[N*N]; double *b = new double[N]; double *x = new double[N]; a[0] = 9; a[1] …

Member Avatar for glao
0
209
Member Avatar for hira_5

Do you mean the constructor? You make a public function within the class that has no return (not void) and also has the same name as the class. #include <iostream> using namespace std; class Square { int _side; public: Square(){}; Square(int side) { _side = side; } }; int main() …

Member Avatar for sfuo
0
118
Member Avatar for apkrieg

Line 17 should be `display->array = (char **) malloc(sizeof(char*) * height);` Note that it is `sizeof(char*)` not `sizeof(char)` because you are trying to allocate char pointers which have a size of 4, where a char has a size of 1. Also your display function will not work as intended because …

Member Avatar for apkrieg
0
356
Member Avatar for sfuo

This is a timer class that I wrote a while ago (cleaned up a bit for the snippet) for adding delays in some of the games I have written over the years. Note: I normally have the class functions in a .cpp file but since it looks like I can …

Member Avatar for dexblack_1
0
12K
Member Avatar for priya.chitroda

Show us what you have done and we can help you if you state what problems you run into. We will not just do your homework for you.

Member Avatar for james.opdyckeii
0
128
Member Avatar for Israel_1

If your function is always going to be composed of `A*x^0 + B*x^1 + ... N*x^n` then why don't you integrate the function analytically and then evaluate it at the bounds x1 and x2 and subtract them. example: `f(x) = 10x - 5x^2` `x1 = 1, x2 = 5` `int(f(x)) …

Member Avatar for Israel_1
0
1K
Member Avatar for sireiz

`int compare (const void * a, const void * b)` The two values 'a' and 'b' are of type void pointer and we want this function to compare two integers so we must convert from void pointers to integers. To do this we first cast the void pointer into an …

Member Avatar for sepp2k
0
2K
Member Avatar for kemkoi

If you are looking to make games I would go with C++/OpenGL or C++/DirectX or C#/XNA. I have never used C# but since it is a newer language and since it was made by microsoft it would probably be very easy to make windows programs and games using their XNA …

Member Avatar for amanahad
0
322
Member Avatar for codeyy
Member Avatar for Icekilla
Member Avatar for Adak
0
176
Member Avatar for Vish0203

strcpy() works with c-strings and those are arrays of characters that have a '\0' terminating character. You are using a C++ string and they have the '=' operator overloaded so you just have to write string1 = string2; and that will copy the contents of string2 into string1. I would …

Member Avatar for rubberman
0
207
Member Avatar for kar0x

If you are new to game programming then you should start with a 2D game. There is a massive gap between 2D and 3D if you plan on writing any of your own code (physics or other engine elements).

Member Avatar for kar0x
0
170
Member Avatar for dreday92

If you have the function prototypes within the class and you want to define them outside, you need to define them with the proper scope. Right now you are just declaring some functions in the global scope. To define the class's functions you need to include the scope of the …

Member Avatar for sfuo
0
108
Member Avatar for Carpetfizz
Member Avatar for breezeonhold
Member Avatar for brian71289

If you were to throw `return user;` at the bottom of your function the error would go away. This is because if for some reason it did not go into your using statements it would never see a return statement.

Member Avatar for gusano79
0
258
Member Avatar for streetalex310

If you don't want to use the table you can just use a program to print out what the char for those hex values would be. #include <iostream> using namespace std; int main() { char message[] = { 0x4B, 0x50, 0x7B, 0xF1, 0xF4, 0xF5, 0x5E, 0x50, 0x7B, 0xF1, 0xF4, 0xF5, …

Member Avatar for WaltP
0
162
Member Avatar for streetalex310

You obviously didn't read the other thread that you started. I posted code that would output what that is and I said it is not a word or words it is just junk.

Member Avatar for ravenous
0
145
Member Avatar for nabeelbhutto

How about you post up some code and then show us exactly where you are having problems. Writing out a big mal-formed paragraph isnt going to make us help you.

Member Avatar for sfuo
0
732
Member Avatar for Epicurus

When I used SDL for graphics I don't ever remember using SDL_GetKeyState(); however, it could have been just a preference that the writer turtorials I followed had. My suggestion (it might not be the best option) is to create your own bool array to manage the key states. You can …

Member Avatar for BeauBeck
0
252
Member Avatar for I_m_rude

> At any point of time, I am asked to return the kth(it is given initally) minimum element from the elements read so far. When I read this I can interperet it three different ways: 1) You are at the 'kth' element and you want to know what the minimum …

Member Avatar for sfuo
0
146
Member Avatar for coolikedat99

There are a few things wrong with your code and you can make a few improvements too. You are getting those errors because your syntax is wrong. If you wanted to input that equation it should look like `cout << (storage_f_to_c - 32.0f)*5.0f/9.0f << endl;`. So not only is the …

Member Avatar for NathanOliver
0
298
Member Avatar for kovacsakos

I find it funny how you are just spam posting really short questions and not really going into any detail. No one will help you if you don't do a bit of work and show us that you have done a bit of research on your end.

Member Avatar for WaltP
0
127
Member Avatar for Rasool Ahmed

Or instead of using an int array you could use a map (or unordered_map if you have a compiler that supports C++11). Accessing the values would be exactly the same but instead of having an array with a size of 97 + 26 (because 'a' is 97 (as said above) …

Member Avatar for Rasool Ahmed
0
287
Member Avatar for dot_binary

> while( clock() < end_time ) ; > > Sorry, but that's a horrible suggestion as it consumes all the cpu time leaving little or nothing for other windows programs. Would this result in hogging the CPU too? I use this lots and after reading this I am wondering how …

Member Avatar for Ancient Dragon
0
3K
Member Avatar for vikrantiitr

> By the way 120 can be of any base from 3 to inf. Thats exactly what hes getting at. If you want to convert A2C3 you have to say what base it is in because this could be anything from base 13 to infinity the way you see it. …

Member Avatar for vikrantiitr
0
132
Member Avatar for jingxian.fs

What that means is that you do not have a main() function present in your code. I have a feeling that you are trying to compile just this file on its own. What you need to do is include this file in a project that has a main() function and …

Member Avatar for Ancient Dragon
0
567
Member Avatar for im abcd

From reading the wiki page for [Greatest common divisor (GCF)](http://en.wikipedia.org/wiki/Greatest_common_divisor) it show to use Euclid's algorithm to find the GCF. The link that shows some pseudocode for using the algorithm is [here](http://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations). And here is a recursive implementation. int GCF(int a, int b) { return ( (b == 0) ? …

Member Avatar for im abcd
0
424
Member Avatar for glao

Why don't you treat this like two 1D boundary conditions ([like the other post that was solved](http://www.daniweb.com/software-development/cpp/threads/429999/periodic-boundary-conditions#post1843619))? If you create a position structure (just contains two ints or doubles for x and y position) then you can return that rather than creating a 4x4 matrix (which you did not allocate …

Member Avatar for glao
0
1K
Member Avatar for Hades80
Member Avatar for Afropuff01

What is the maximum value you are putting into these shorts? Are they signed? If you are not filling the shorts right up, and they aren't signed, then maybe you can get away with packing them all into maybe 12 bits rather than 16 (a short is 2 bytes (16 …

Member Avatar for Momerath
0
193
Member Avatar for glao

I don't know what this "sth" is and I don't know what assumptions you are making as far as the size coming in goes, but here is a method you could use. int boundary( int pos, int step, int size ) { return (pos + static_cast<int>(size/2) + step)%size - static_cast<int>(size/2); …

Member Avatar for glao
0
3K
Member Avatar for coolikedat99

You can use strings rather than chars. If you do not want to read in spaces then you can use cin as your method of input. If you want to include spaces (something like a frist and last name) then you need to use getline(cin, str) for input.

Member Avatar for coolikedat99
0
166
Member Avatar for Bumpehh

I would like to say that I agree with WaltP and that you should start off with learning the language before trying to hop into making a game with graphics. The first game I ever made was black jack in a console window (looking back on it, it was a …

Member Avatar for Bumpehh
0
739
Member Avatar for cmmmm

I'm pretty sure that in Java, like C++, if you pass an array into a function it automatically passes by reference. This means that you do not have return the array to upadte it in main(), since every change done to the array is done where the array is actually …

Member Avatar for JamesCherrill
0
771
Member Avatar for phorce

I kind of see what you are trying to do with the nested for() loops but it is wrong. For distance I would just make a function that takes in the two coordinates, or this 4 element array, and then just plug it into the formula. Also in C++ you …

Member Avatar for phorce
0
209
Member Avatar for MasterHacker110

In <windows.h> ERROR is defined as 0. So unless you were to undefine ERROR before your enum you would be writing enum ERR_CODE { SUCCESS, 0 }; because the preprocessor just does a "find-replace" for ERROR and swaps it with 0. A quick solution would be to just define SUCCESS …

Member Avatar for MasterHacker110
0
6K
Member Avatar for rithish

There are a few methods for finding the det of a matrix. [Here](http://www.purplemath.com/modules/minors.htm) is an example for using the minors method.

Member Avatar for sepp2k
0
116
Member Avatar for rithish

On line 16 you need `scanf("%d", &a[n-1]);` It was not working because scanf() takes in a pointer to the variable in which you want to write to. The reason why you need to write to n-1 is because if you have an array that has a length of 5 the …

Member Avatar for sfuo
0
90
Member Avatar for gizmo7008

The code that you are using for checking who wins is pretty bulky. If you just treat the hands like 0, 1 and 2 and that higher numbers beat lower numbers with the exception that 0 beats 2 then you can just use the mod operator to wrap around and …

Member Avatar for gizmo7008
0
902
Member Avatar for JamesArhy

If you want to you can create aliens using the new operator and store them directly into the vector instead of creating aliens individually then storing the reference of them into this vector of pointers. std::vector<Alien*> aliens; aliens.push_back(new Alien()); aliens.push_back(new Alien(100, 200, 30, 30, 1, 172)); You just have to …

Member Avatar for sfuo
0
805

The End.