- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 3
- Posts with Downvotes
- 3
- Downvoting Members
- 3
123 Posted Topics
Re: You're going to want to open a stream to the file, probably with an [ifstream](http://www.cplusplus.com/reference/fstream/ifstream/), and then read it line-by-line. The `ifstream` has several extraction methods, but it may be easier to use the `getline` function, which reads entire lines at a time ([see here](http://www.cplusplus.com/reference/string/string/getline/)). You will probably have some … | |
Re: Are you using a library that has matrix and vector classes? Are you using arrays? It seems to me, if you're using something pretty simple (such as arrays), moving through each index of the vector and copying the contents of that location in the vector to the matrix would work … | |
How do Vim and Emacs allow the whole console to be used, even after an enter has been recieved? (this can be Windows-specific) I've got unbuffered input, and I have methods for output to print to anywhere in the console. What methods do Vim/Emacs employ to make the entire screen … | |
Re: It depends on what you need. If you need unicode characters, then use the wide varients of the char type and it's related wide std::string type. The char type will work on Windows and Linux, but if you try to use unicode, it will fail on Windows _and_ Linux. | |
I've been working on a small API/Library and I realized that I was returning memory that wasn't going to be consistently put on the heap or stack. So my question is this: when I return an object from a function in a Library, should that object be on the heap? … | |
When connecting to a database, is it best to use one SqlConnection object for the entire server, or use one for each connection? I couldn't find a good answer in Google, but maybe my Google-fu isn't good enough. | |
Re: Have you made an attempt yet? If not, then please do before posting. Also, your question is very hard to understand. I can't tell just what you want from what you've posted, so I don't feel particularly inclined to help you. | |
Re: Because while(TRUE) will give you an infinite loop. See [here](http://www.cprogramming.com/tutorial/c/lesson3.html) for more details. | |
Re: Lines 27 to 31 have a problem involving the if and else clauses. I'll leave it to you to find out just what is wrong, becuase this seems to be an assignment. This isn't the only problem I found, just one of the most glaring. Also, in the future, please … | |
Re: The basic idea when you're doing anything of this nature is to (assuming you're not going to use a more advanced algorithm) is to take a given item (name, in this case) and compare it with all the other options. The most basic way to do this is to have … | |
Re: When you initialize an array via the = new <TYPE>[]; method, the array is created, but the objects are not. This means that when you try to run methods on them, like in line 16, they will throw a NullPointerException. If you initialize them (in a loop or otherwise), the … | |
During the process of creating my latest game, I've come across the problem of collisions. In the last few games I've made, I've used a system of collision detection that relyed on two rectangle's methods. This seems to work, but doesn't provide a method for dissallowing an entity entry into … | |
Re: I started when I was 9, and was learning a game's script engine language (I think it was called Action Script), then, a couple of months later, I bought a book on C++, and learned the book's contents in a couple of days (Up to classes, and yes, I mean … | |
Re: Well, Java is pretty much completly cross-platform, and the USB should be able to install its own drivers... It does is for me... (like when I plug in a new drive). As for no install file, you can just create a .jar file and lauch it within an autorun file. | |
I've got a game, and I'm trying to do it right. I've got a spritesheet (which is really just a class that loads images for easy access. It seems to work, but then my tile system starts, and it fails in an interesting way - it loads only the foreground, … | |
Re: You need to put the code in for the " Code blocks are created by indenting at least 4 spaces ... and can span multiple lines" | |
Re: Do you need to take the tweets and decipher their meaning? If so, go become a masters degree in Artificial Intelligence. (Not to be discouraging, but that is truly very, very difficult to do.) If not, use a loop and a switch ([CODE] for(int i=0;i</*Value*/;i++) { switch(testValue) { case testThing: … | |
Re: Thats not any C++ code I recognize... is it SQL or VB? | |
Re: Memory allocated with `new` can be de-allocated with `delete` [Wikipedia Article](http://en.wikipedia.org/wiki/Delete_%28C%2B%2B%29) One thing to note is that array allocated with `new[]` must be deallocated with `delete[]` int integer = new int; int* pointer = &integer; delete pointer; | |
Re: Is there something wrong? I see a few things, but they should become apparent after you try to compile it. | |
I have a project going (the idea for which I got from a website a couple of years ago) and its been going pretty well. However, I have come upon a strange error, which I can't find the source of (well, I know the source but I don't know what … | |
Re: Always, always, always use `equals()` for comparison between the texts of Strings. == is only used for checking if a String is null or not. String s1 = "Hello!"; String s2 = "Hi!"; //s1 might '==' s2, but !s1.equals(s2). Hope that makes sense! | |
Re: Start by trying yourself, then posting any problems on the forum. We can try help from there. | |
I've decided to try to create a small (very) game in Javascript + HTML, using the Canvas element. So far, its gone pretty well, but recently I started on bullets. This also has gone well. I've decided to try to implement a bullet-goto-mouse type thing. I know this uses trigonometry, … | |
I've got a wall in my 2-D game. I've got everything except the not-allowing-you-into the wall part. I know I can use the intersect method on some Rectangles to know if they intersect, but I need to know where they intersect so that I can kick them out when they … | |
Re: By "run" do you mean re-start the program, or loop through the program multiple times? | |
[CODE] #include <vector> #include "Rab.h" class Envo { vector<Rab> items; };[/CODE] the error is: [ICODE]error: 'vector' does not name a type[/ICODE] I can't find ANYTHING that's wrong. Is someone else able to find it? BTW, Rab.h contains the class 'Rab'. Jack | |
Re: If I'm not mistaken there's a function in one of the stream library's that allowes you to change the type (if that's the correct word) of number. This might require creating a stream, which may or may not be what you want to do. Hope this helps, Jack | |
I've got a little inventory management system going, and it searches for products by name. It also loads old data from a file on the hard disk. For whatever reason, when it loads the name, it doesn't accept the name that it displays in the save/buy functions. If that doesn't … | |
Re: I switched A few weeks ago and I love it! I had to find a few ways to do some things but almost my entire array of tasks I had no problem setting up. The only hard one was printing, I had to find the URI and manually set it … | |
I've made a little game (not really, just a bit of a start), but the collision detection is a little screwy. It works within 2 pixels for the bottom three sides. However, on the top, there is a buffer of about 20 pixels that it counts as part of the … | |
When I try to put the JTextArea in a JScrollPane, it a) doesn't display the menu most of the time, and b) doesn't display the scroll bars, even though I've got more text than the size of the JTextArea. Code (it's a VERY simple error console for something else): [CODE]import … | |
So. I've written my first little graphics game (using the Graphics API) and would like to know two things: a) What's wrong with my collision detection? (Could you point me in the right direction?) b) What am I doing that is not the best way. Is there a better way … | |
The error I'm getting makes NO sense seeing as I'm defining the functions it's confused about directly above. The error: undefined reference to `accMan()' undefined reference to `bookMan()' undefined reference to `lend()' undefined reference to `getBack()' undefined reference to `tellMenu()' undefined reference to `tellMenuAcc()' undefined reference to `tellAllBooks()' undefined reference … | |
Hi! I heard of a thing called Hotswap debugging, but I haven't figured out how to use it. I can't find a download anywhere, nor can I find a thing called hotswap debugging in the debug menu (I use Eclipse). Just wondering, Jack | |
Re: It seems that you have one score, and you keep inputting to it. I would suggest that you make a list of somekind, and input them into that. The names can be done the same way. Then loop through, adding each students score to an int. when you're done, divide … | |
Re: I would decide how you are going to handle cases (F is, or not, equal to f) and start looping through the sentence array. While you are looping, take note of each time the given char appears. Each time you encounter a new line, take note of that (or just … | |
Re: You should create a boolean and set it true when you open a webpage. Then, when you try to open it again, test to see if it is true. If it is, don't open the page. If not, go ahead and run the code. | |
Re: I THINK that is a problem with the character encoding. I don't know how to fix it, but I thought that that might be a future Google search. Sorry about my un-helpfulness. -Jack ![]() | |
Before you read this, please don't say how I could make this better, I've thought of it, or because of the circumstances, it's not possible. I'm having a problem where when I input a command into the Runtime class's exec function, it doesn't run. When I try the exact same … | |
Re: You should use a list or vector instead of arrays. This would prevent people inputting more than 1000 employees or jobs. I think that you should not have the JobOnSystem/EmployeeOnSystem class (in my opinon), instead I think you should make the two arrays Lists and start by making the needed … | |
Sorry, but I REALLY don't understand what could possibly be wrong with my code (or maybe it's not my code?). When I run the writeChar(char*,char) function, my program crashes. I really don't have any idea why, as my pointers (I think, I've checked, but I'm not very good at that) … | |
Re: Well. You should start by looping around to ask for inputs. This might look like this: [CODE]String lastInput; while(lastInput.equals(/*Some string that means to stop asking for input*/) { System.out.println("Enter a first name. Enter '0' for stop."); lastInput = input.getLine(); if(lastInput.equals(/*Some string that means to stop asking for input*/) break; } … | |
My problem is that when I try to gather the parts of an array, the part of my code that decides what to keep seems to be making a mistake, though I can't fathom how it is making that mistake. My code is posted below. You should see the parts … | |
I need to take the end off of a file. What I mean is that I have a file, and it has an end marker, but I can't write past the end marker. Is there a way to do this? | |
Re: I think there's a char code that you can use. (like /20?) | |
Re: I don't know the Win32 API, but I would recommend Googling, and searching Microsoft's documentation ([URL="http://msdn.com"]http://msdn.com[/URL], I think). It works for me almost every time! | |
I get this error, [CODE]Exception in thread "main" java.io.IOException: Cannot run program "java -jar C:\Users\Jack\testFile.jar\" (in directory "\"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at testProject.Main.main(Main.java:15) Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) … |
The End.