5,727 Posted Topics
Re: you should anyway use ifstream instead of fstream for reading... Omitting all errorchecking, the following will read and echo lines from a textfile: [code] #include <fstream> #include <string> #include <iostream> #include <iomanip> int main() { ifstream fs; fs.open("test.txt"); string s; while (fs >> s) cout << s << endl; fs.close(); … | |
Re: Before you can debug it you have to get it to compile. Start with the very first compiler error, solve that one. That alone may well solve a lot of other errors. Your dispense function is seriously flawed. Not just will it generate quite a few compiler errors, the logic … | |
Re: in fact, he's done nothing at all beyond declaring some variables and function prototypes (which were probably just copied from the assignment paper). Do your own homework kama, it's the only way you'll ever learn anything. Questions like yours make me believe there should be a minimum requirement of a … | |
Re: any function that takes more than 3 arguments suggests heavily you would benefit greatly from encapsulation. Think up some classes for starters. What does it do, and what do you expect it to do? Use a debugger to go through your program and check where it does something unexpected, that … | |
Re: Quite possible. What fileformat did you save them as on the mac? And did you format the flashdrive on the mac? That could make it impossible for a PC to read (depending on the filesystem you used). | |
Re: Ever more DVDs feature extensive copy protection. This may prevent them from being played in computers. Just get a real DVD player, they cost next to nothing and the image quality is a lot better on a TV than on a computer screen using some software. It of course makes … | |
Re: what an idiotic rant that kid puts up... If you don't know how to do things under Windows that doesn't mean Windows is bad kid. It just means you're ignorant and may well be too lazy and/or stupid to even try to understand what you're talking about. Now go back … | |
Re: [QUOTE=frrossk]Didn't you read the posts above yours?[/QUOTE] Of course not. Reading is too much hard work, almost as much as coding. In fact, even starting your own thread is too much... | |
Re: Looks like an entire classroom full of kids has gotten their homework assignment and are all posting it at the same time :) | |
Re: You're not following your instructions. Where is your class? | |
Re: and the same goes for all other linux and most bsd distros. | |
Re: What you want to do is tantamount to a denial of service attack, don't do it. As to the technicalities involved, there's no need to interact with a browser at all. Just use UrlConnection. | |
Re: If you're so ignorant about Windows architecture and versions, what qualifies you to make statements like "p stands for patch"? No need to politically correct anti-Microsoft rants here kid. Windows 98 is by now 7 years old, it's end of life. In other words: don't use it, use XP which … | |
Re: only 1 thread can access the file at once as the file pointer WILL move during the read and write operations. Say you're reading and have read 100 bytes. Now the other thread moves in and starts to write after setting the file position 1000 bytes from the end. After … | |
Re: clrscr() is a custom extension introduced by MSC. | |
Re: just when I don't have my Latin dictionary with me. Yes, I used to study Latin in school but I've forgotten a lot of it. That's what happens when you don't use it regularly :( Maybe the official website of the US office of engraving and printing (the guys who … | |
Re: call the chemical waste disposal people to take the stuff away and watch as they scratch their heads as to why computer parts are chemical waste (they are...). | |
Re: you mean you want to print an octal representation of a decimal number? Check out your language reference for itoa. | |
Re: Determine the top corner of the component you use to display the image and use those as an offset. For example if the image is displayed from 100,100 on your application window and your mouse coordinates are 150,150 your coordinates in the image would be 50,50 (or was that 49,49 … | |
Re: that's likely the problem. There's only 1 possibility for that not to be an infinite loop in which case the loop terminates immediately. It's also an empty loop... Most likely the semicolon shouldn't be there and some braces were forgotten. | |
Re: Enlighten me: if you knew in advance it was so easy why even bother asking and not just think about it yourself and get a solution? | |
Re: run it in the debugger, see what happens. Set some breakpoints and watches and step through your code. | |
Re: More likely someone send the offensive messages using a fake address which happens to match your friend. Another possibility is that his machine has been compromised and someone used it to send the offending material. In that case he'll have a hard time proving it wasn't him and may have … | |
Re: yup. What I find rather troublesome is that he uses System.err for non-error output... It would be much preferred to read the inputfile through the commandline. | |
Re: not using a function that returns an array... You can of course return an array that contains only 1 element. | |
![]() | Re: Eclipse and JBuilder are the best in the business. IDEA is supposedly also excellent, I've never used it so I can't tell. I never liked Netbeans/Forte. Poor project management, poor performance and a memory hog (this goes for every version I've used which means every major release). Shall we get … ![]() |
Re: what you are describing are [b]cracker[/b] tools, not [b]hacker[/b] tools. Despite the media mislabelling crackers as hackers there's a huge difference. Most crackers couldn't hack if their lives depended on it. A hacker is a creative person, often with a rather geeky dry sense of humour. A cracker is purely … | |
Re: And don't forget it's extremely rude to hijack other peoples' threads. | |
Re: why will you only build the system if you make it easier for us to help you? As to the String validation, check out the regular expression package in Java 1.4 and later. It's purpose built for things like that and extremely powerful. | |
Re: of course it's homework. If it were not it wouldn't be worded as "do this, do that" which is most likely an exact replication of the text of his assignment... | |
Re: hmm, getting abusive when someone doesn't know his lingo? Do you know my language? I think not yet I don't mind... If I'm wanting to post on a Spanish language site I'll take the trouble of posting in Spanish (which would be hard since I don't know it). On a … | |
Re: Why are you combining C++ STL with old-style C constructs anyway? It would become a lot easier if you use list<string> instead (and fstream functions for the file handling). | |
Re: You will have to nest different layout managers. Make a component that is a JPanel with a GridLayout containing a label and a slider (so 1 row of 2 columns). Then add that to your borderlayout where you want it to appear. That way it should line up as you … | |
Re: strstr is a standard function that searches for occurrances of one string inside another. This is exactly what grep does at its most basic. It can indeed not search case insensitive but with a little thinking you will be able to figure out how to use it anyway. Hint: how … | |
Re: All it prints is a compiler error and some warnings when compiled using GCC. Correct code is: [code] #include <iostream> #include <string> using namespace std; int main() { char s[50]; strcpy (s, "What "); strcat (s, "does this " ); strcat (s, "do?"); cout << s << endl; return 0; … | |
Re: [QUOTE=boujibabe]Okay #1,Thanks for the help! #2 I only a begginer so I really don't understand about 60% of it #3 one of the sample outputs says shift 8 places so i'm pretty sure it has to shift more than five places without looping and tempt is an array used int … | |
Re: simplest sequence (not recommended for large files) without error checking read filename(s). open file with given name for read-only read entire file into buffer close input file open file for output as write-only write buffer from the end one byte at a time close output file | |
Re: A better way is to pass it to the second method as a parameter. Especially since main is static and pulling the variable outside main would cause all kinds of other problems (especially if multiple instances of the class are created). | |
Re: Start small, really small. Games are massive undertakings, taking large teams of extremely tallented and highly experienced people years to create. For example, every version of Microsoft flight simulator takes a team of about 50 people 2 years to create and that's possible only by reusing a good part of … | |
Re: And which is line 94? I'm not inclined to go count your lines and see which generated the error. You probably have a string or character literal somewhere which doesn't have closing quotes. Or else you have a quote somewhere where it doesn't belong leading the compiler to think you … | |
Re: learn to read, that usually helps. Don't start coding, start thinking. That helps even more though it requires you can read... | |
Re: OEM software (and hardware) sounds cheap but it's actually illegal to sell and buy. It also usually comes without manuals and may well be a stripped down version. OEM software is licensed for distribution with specific hardware to a hardware manufacturer. Standalone distribution is strictly against the license agreement (usually … | |
Re: hmm, sounds awfully like that other guy who spammed the forums a few weeks ago with an almost identical question. Was that guy banned or is this a classmate who found out a bit later he wouldn't get away with not doing his own homework? | |
Re: what is it you want to do? what is it you have done? what is it that's not going as planned? Just showing a bunch of code and pasting your assignment, then expecting someone to do all the work for you isn't going to help you. And if it's really … | |
Re: Are you talking the runtime or the SDK, and what OS are you working on (there are different requirements for either)? I've installed both without problems on Windows 2000, except for the SDK installer crashing once (it worked fine after I started it again). | |
Re: Since you're doing a masters in CS you'd better start learning to do your own work rather than have others do it for you. I know you're probably planning to go into management and never code again after you get your degree, instead placing impossible deadlines on us who do … | |
Re: You don't want the page numbers inserted into the text editor. What will happen if you add or remove text? The numbers will now no longer be properly positioned, instead showing in the middle of the pages. Instead you'd better customise your printing routine (I guess you want to print … | |
Re: try something like [code] vector<int> v; string s; while (cin<<s) { if (s != "\n") v.push_back(atoi(s.c_str())); } [/code] replace \n with the corresponding value for your OS (or find some way to detect it and use the detected value). |
The End.