2,045 Posted Topics
Re: Your sentinel is given to you and is not a number so trying to compare your character to a number is not right. SENTINEL should be of type char and be equal to '.' It should become apparent based on what AD told you to what you should compare your … | |
Re: You mean for disposing of it? Run the edge of it through a good solid paper shredder(be careful to keep your fingers). Otherwise if you are trying to use it yourself how would you read it with a bad sector? | |
Re: All of your reader/writer definitions should probably be wrapped in using() , e.g., [code] public string ReadWholeFile(string file) { //create a string variable to hold the file contents string fileContents; //create a new TextReader then open the file using(TextReader reader = new StreamReader(file)) { //loop through the entire file while … | |
Re: [quote]this code is not mine, and i need to write somethink like this but not exactly this way. [/quote] That doesn't sound the least bit like you want us to help you cheat. There's one good way to do what you want to accomplish, try it yourself and come back … | |
Re: How about (I use a dictionary but you could use any container to keep track of the line numbers or strings): (you can flesh out the other portions -- I can't have all the fun) [code] bool found = false,last = false; //strdict is of type <int,string> while ((temp = … | |
Re: [quote] I figured I would go ahead and introduced myself now. <snip> After being a member for a few months I have decided to stay. [/quote] I realize this is the resurrected part of the thread but it made me feel better since I had been (and still am lol) … | |
Re: You are not getting any output because all the programs you have posted are calling decrement() but never displaying the value it returns. If you can output within your recursive function itself it will make things easier on you. | |
Re: Here's the heart of it. Adding it to the listbox is a matter of taking the substring 8 characters long after the indicies found. Text is a string found by reading all of the text file until the end. [code] List<int> intlist = new List<int>(); string pattern = "te_"; int … | |
Re: [quote]i'm using windows xp and turbo c++ 3.1 and also 3.0[/quote] [quote]give me a clue that what is wrong with the compilers[/quote] Have you tried anything like mingw (included with Code::Blocks or standalone) or Visual C++? All of the above are free and much much more recent (to put it … | |
Re: First off, what is the actual problem at hand?? Secondly, what code have you tried so far to solve this problem? | |
Re: [url]http://www.csharp-station.com/tutorials/Lesson15.aspx[/url] (or google C# try/catch for plenty more) | |
Re: I found a good article [URL="http://www.devsource.com/c/a/Techniques/High-Performance-Timing-under-Windows/1/"]here[/URL](see the QPC section). Windows has a certain amount of wiggle room between interrupts lowering the precision of the timing (I don't know much beyond that) and this is why people turn to embedded and real time solutions. | |
Re: You can force garbage collection in your program. See: [url]http://msdn.microsoft.com/en-us/magazine/bb985010.aspx[/url] But also see this (and related opinions [I]against[/I] doing so on the web): [url]http://stackoverflow.com/questions/233596/best-practice-for-forcing-garbage-collection-in-c[/url] | |
Re: Can you use [icode] RectangleF rf = r.GetBounds(graphics);[/icode] then [icode] if(rf.Contains(p)) [/icode] do whatever? I'm assuming that graphics is of type Graphics and is initialized somehow. | |
Re: Pop in a second variable to keep count in your new array. [code] int j = 0; for (int i = 0; i < customer.Length; i++) { if (TypePerson.Manager || TypePerson.Vip) { importantCust[j] = customer[i]; j++; } [/code] | |
Re: [quote] should i not use arrays to do this? [/quote] Unless you know the exact number of records you will have (or it can be determined at runtime e.g, by the user entering a value), it is far better in most situations to use a list. Take a look at … | |
Re: See [url]http://www.parashift.com/c++-faq-lite/operator-overloading.html#faq-13.7[/url] . It's within the answer to another (not really related) question but the information is the same. | |
Re: Welcome. Is there a specific issue you are having with the program? Please let us know so we can help you better. EDIT: One change right away: [CODE]#include<iostream> //no .h for the C++ standard #include<cstdlib> //C++ version of header stdlib.h #include<cstring> //you were partly right[/CODE] | |
Re: Welcome. Please read the following [url]http://www.daniweb.com/forums/announcement8-2.html[/url] and please note that we do not give "complete program"s. | |
Re: What do you have so far (for the code)? Hint: You'll need to use "for." | |
Re: [icode] $year=floor($time/([B][I][U]360.25[/U][/I][/B]*24*60*60));[/icode] If you're going to be Captain Smartguy, you ought to have your numbers correct at the very least. | |
Re: [quote] I can't find anything wrong with it. [/quote] Never mind the fact that it doesn't compile, you have the syntax for printf and scanf completely wrong, and least of all it's some C/C++ hybrid program... For better or worse, the compiler is usually right. | |
Re: This is a better way to have it: Player.h [code] #ifndef PLAYER_H #define PLAYER_H #include <iostream> #include <string> using std::string; class Player { string name; int score; public: Player(); Player(string name); string Get_name(); void Set_name(string name); void Input_name(); }; #endif [/code] Player.cpp [code] #include "player.h" using std::cout; using std::cin; Player::Player() … | |
Re: Take out a piece of paper and write out 2^2 in terms of 2, then 2^3 in terms of two, and to the fourth in terms of two until you see the pattern. Break the product 2 ^ n down into n steps, take what happens at each step and … | |
Re: [quote] Just find the amound of hertz. [/quote] Not entirely true. "CPU instruction rates are different to clock frequencies, usually reported in Hz, as each instruction may require several clock cycles to complete or may be capable of executing multiple independent instructions at once. Additionally, the number of cycles required … | |
Re: I may be missing something but in the inorder method, you have an if statement. Either path that you take calls the function recursively and there doesn't appear to be a stopping condition. One thing I noticed too on lines 29 and 159 you are trying to assign the value … | |
Re: Hint: use your inner loop to control the spaces. (also please do yourself a favor and read [url]http://www.eskimo.com/~scs/readings/voidmain.960823.html[/url] ) about void main. main() should return an int. Make it a New Year's resolution) (and of course code tags...) | |
Re: There's no need to translate anything in terms of the DLL. See this link: [url]http://msdn.microsoft.com/en-us/library/aa288468(VS.71).aspx[/url] What do the header files contain? With the dll import you will be specifying your function prototypes right in the C# code. Any #defines can be translated into consts (or into methods if they define … | |
Re: Similar to what I reported in [url]http://www.daniweb.com/forums/thread249581.html[/url] (there's a disparity in my solved threads too). If it's the same situation, it has to do with the mysterious "reported posts" forum which is visible to moderators. I'm not sure how we would get credit for threads solved there as we would … | |
Re: I'm surprised it didn't give you grief for pow, as there is no definition that takes 2 ints ([url]http://www.cplusplus.com/reference/clibrary/cmath/pow/[/url]) Look into fmod ([url]http://www.cplusplus.com/reference/clibrary/cmath/fmod/[/url]) which is like % but for floats/doubles/etc. Also, you should include <cmath> instead of math.h and main() should return an int. I ran the program but I … | |
Re: He's talking about the line numbers in your second program. Whichever one you are working with, get rid of all but one srand() call, which should be situated anywhere before the first call to rand() -- but preferably at the top of the program. | |
Re: I think this is what you are looking for. I didn't test it with an application though. tbMessage is a rich text box and btnSend in this (pretend) example would send the text to the other conversant. SendMessage was added in just so the button would have an action. [code] … | |
Re: I'm sure that there's some "pull the ripcord and the whole thing falls into a nice answer" approach, but I would just convert the base 8 to base 10 and make some guesses (e.g., you know it's not base 8) cause the two would be equal. That should give you … | |
Re: What does that particular segment of your code look like (if you're able to post it)? MathBot sounds interesting -- combing netspace to solve random equations it encounters. ;) | |
Re: google "C++ pointers references" and variants thereof | |
My post total just jumped by about 50 since last time I checked this morning. EDIT: It only shows that in the profile. On my posts themselves it says the right amount. | |
Re: You are not the first person that has posted here to deal with this problem. Do a search on the forums. Hint, break the number that is input into pieces, going from largest to smallest. You probably know those pieces well, or if you don't look the system up on … | |
Re: Yes. What do you have so far? Please read [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: So what do you have so far? Even if you haven't covered this exact assignment I'm sure you have all the tools with which to tackle it. Can you write a menu with those selections and call an appropriate function for each (even if it's just a skeleton for a … | |
Re: Part of the problem is you want lcv == CHARCOUNT on line 36 -- you've traversed the entire array to the end and the character isn't there. Ignore what I said in my other edit about EOF, but make sure your user knows to hit EOF (ctrl-Z or F6) at … | |
Re: Try taking the call out of InitializeComponent as I'm not sure it's considered part of myControl1. Try calling just plain Init() in the constructor of MyControl after InitializeComponent(). It's balking about that line because if Init() is not being called correctly the image is indeed going to be null. | |
Re: For C++ QT is a decent library and it is somewhat portable (it's distributed by Nokia now). There's a free pdf of a decent book(released by the author under Open Publication) at [url]http://www.qtrac.eu/marksummerfield.html[/url] (the author's website). He steps you through (and they are nice manageable steps) making a very small … | |
Re: words[m] is just one char | |
Re: [quote] Compare your post to the following statement: My car only makes noise when it runs. Please help me fix it. [/quote] Indeed, moreso the equivalent of parking one's car diagonally across the repair bays at one's local service station and leaving it overnight. (*the usual apologies for the bump … | |
Re: Under the Edit menu, Advanced, (uncheck) View White Space CTRL-R,CTRL-W (first one, then the other or both at the same time) (I remembered these from a similar setting in Word -- not the same keystrokes I don't think) | |
Re: You're unfortunately about 2 days too late for presents. Please take a look at this [url]http://www.daniweb.com/forums/announcement61-2.html[/url] . On the bright side it sounds like it could be kind of a neat project! | |
Re: One thing to consider: [code] else { node*temp=top; } //where is temp at this point? nowhere it's been destroyed [/code] Small(er) stuff: It should be #include <iostream> and #include <string> (the latter of which you don't really use in your program). You need [iCODE]using namespace std;[/iCODE] (or better yet [iCODE]using … | |
Re: Just to clarify, are you reading your data into the program or is the user typing it in? However, in reality your struct should be the same either way you do it. OL# can be a string member of your struct, or you could make it an int member and … | |
Re: Clear clears the failbit (a flag (bit) that was set to true when your used typed in a letter for your id instead of a number). cin.fail() is what checks the bits to see if the failbit has been set and returns true if it was. At that time that … | |
Re: Where does words[] come into play? I see you declare it at the beginning and you try to display it at the end but it's no where in the middle... Also, why is name 20 chars and temp 10 chars? What happens if you try to copy a long name … |
The End.