- Strength to Increase Rep
- +11
- Strength to Decrease Rep
- -2
- Upvotes Received
- 106
- Posts with Upvotes
- 98
- Upvoting Members
- 78
- Downvotes Received
- 8
- Posts with Downvotes
- 7
- Downvoting Members
- 7
Re: 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, … | |
Re: 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> … | |
Re: 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; … | |
Re: 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 … | |
Re: 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. | |
Re: 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. | |
Re: 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; … | |
Re: 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 … | |
Re: 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 … | |
Re: 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] … | |
Re: 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() … | |
Re: 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 … | |
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 … | |
Re: 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. | |
Re: 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)) … | |
Re: `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 … | |
Re: 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 … | |
Re: Do you want the one function to be able to output both shapes? | |
Re: You would have to use a custom data type. A double can only hold so much precision. | |
Re: 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 … | |
Re: 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). | |
Re: 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 … | |
Re: why do you have the return 0; line out of main()? | |
Re: Well line 86 is going to have the same problem. | |
Re: 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. | |
Re: 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, … | |
Re: 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. | |
Re: 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. | |
Re: 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 … | |
| Re: > 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 … |