2,045 Posted Topics
Re: [icode]while (n >= 1 && n <= 30) [/icode] since the while loop runs while it's true you want it to cut out when either one of these is false. It's a bit counterintuitive at first. To solve your other problem, I believe you need [code] float n = 0f; … | |
Re: You have not made an instance of your struct like: [code] struct addressbook { char name [NAME] ; char address [ADDRESS]; char phone [PHONE]; char email [EMAIL] ; char Target[NAME]; } addresses; [/code] In fact you probably want an array of them so #define the number of addresses (say NUMAD) … | |
Re: What are the specific errors that you got (the first 5-10 are good for now). Also, I see you tried on the code tags but it has to be [noparse] [code] //code here [/code] [/noparse] | |
Re: At what point do you get the seg fault? One hint is that your filename is not making it into your readin function at all. You've appeased the compiler by redeclaring it but there's nothing in it. I suspect there are other areas as well. If you're going to use … | |
Re: Would it be possible for you to use an array called W and fill in the elements 12, 13, 14, etc. I understand what you are trying to do but I do not believe C has an "eval" type command that can assign variable names at runtime. How would you … | |
Re: [quote]Give me a tutorial [/quote] This is very demanding and bordering on rude. Despite that I (more than wholeheartedly) agree with WaltP's sentiment I still wanted to plug a book that I really liked which was [URL="http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip"]this[/URL]. It's also legitimately free which is nice. | |
Re: MaxLength is the constant that you should compare against. I think the comparison would be textBox1.TextLength > textBox1.MaxLength, but I tried it a few times and it looks like you don't need to do anything because once you're at the MaxLength it won't let you add anything more into the … | |
Re: Learn just a smidgen about wavelet transformations. Those are used in image processing and denoising methods of all kinds. Next time, though, try to search more extensively on the net because you couldn't possibly have missed something like numerical integration. | |
Re: Unless I misread what you need I think you are complicating things a bit more than needed. Try something like the following (I'll let you flesh it out): [code] for (int i = 0;p_cString[i] !='\0';i++) if(p_cString[i] == valueToFind) { [/code] Since you know the length of your string you could … | |
Re: [quote]Yea but this is for Visual Studio 2003 and I'm using 2008.[/quote] It's identical, I just checked it to make sure. Mine just says "Properties" on the project menu but I've seen it say "MyProjectName" Properties at points. Click on configuration properties on the sidebar of that window to get … | |
Re: Firstly, presentation is paramount. Please wrap your code in code tags. Use the edit button to edit your post. [noparse] [code] /*code goes here */ [/code] [/noparse] You may be frantic but there's no need to panic, this is a solvable problem. I haven't run your program yet but there … | |
Re: Welcome to floating point. :) You'll find that small errors here and there can propagate very quickly. First try a much better approximation for pi and see how it changes things. It may buy you a little bit. Also, going from floats to doubles probably doesn't buy you much and … | |
Re: What DS means is don't try to return a value, just have a [icode] return; [/icode] statement where you need it. If is not a loop anyhow. What is the specific warning you are getting? | |
Re: [quote] What is this->Controls->Add(color);? What will happen if code below is without this->Controls->Add(color);? What is the result from the code this->Controls->Add(color);? [/quote] This statement actually adds the button you have created to the set of controls(buttons, listboxes, etc) that are associate with your window. Without it you won't have access … | |
Re: All you've done there is put the names into a string array. I think what you mean is if you had the class Rectangle, you could create an array of rectangles by saying [code] Rectangle [] rects = new Rectangle[5]; rects[0] = new Rectangle(10,10,1,1); rects[1] = new Rectangle(5,5,1,1); etc. [/code] … | |
Re: [quote]I have a few other subclasses of Event and they aren't giving me any trouble.[/quote] How are their class declarations different from this one? I don't see anything in this one that's incorrect. | |
Re: Is it a 2D vector or is there another vector at each of the positions(like a 3D)? Perhaps a small piece of the code would be helpful. | |
Re: Depending on the layout of the file you should be able to use fgets to get the string and then use strcmp to compare it. If this is a direct continuation from your other thread's question you should ask a moderator to close this one and merge it with the … | |
Re: Are you allowed to use a vector? If so you just pass in the vector and you'll have the count and you can find the max in the bucketSort function itself. Even if you can't use the vector (noting your use of printf might lead me to believe that you … | |
Re: [quote]but what I have here completely makes sense..[/quote] To you maybe, but it doesn't work for the compiler. The other poster was correct. | |
Re: [icode]myfile << data_[i+ndim_*j] << " "; [/icode] should be [icode]myfile << data_[i+mdim_*j] << " "; [/icode] Since you are jumping by a count of the number of rows each time you span a column. Do a quick "desk check" of it with pencil and paper to see. | |
Re: [U]Thread closed[/U] means no one can post on it anymore, it doesn't say anything about the forum. Aia just wanted you to read the information that was there. You haven't done any irreparable damage (at least not in my book) but it considered quite rude to "bump" your thread up … | |
Re: [quote]@HBK_100[/quote] Unfortunately, you're wasting your time. Read his/her user title. | |
Since mid-afternoon the text in the C forum has been showing up centered on the page (thread listings, threads). I'm using Firefox 3.58. I just checked on IE 8 and it looks ok except that the Intel banner ad is in the wrong place. Anyway, just thought I would let … | |
Re: Move the endl in the for loops outside of the first one so it's only called once per row. Also, you don't verify that your input fulfills those criteria you just print it out. See [URL="http://www.daniweb.com/forums/post1021268.html#post1021268"]this thread[/URL] to get some idea of what's involved. If that's a lot, simply test … | |
Re: Matrices in C/C++ are laid out rowwise (versus columnwise like you are doing,used in FORTRAN and probably others, I think) first one row, then the next, etc. So expanding your first matrix would look like 1 2 3 4 5 6. There's no need for rearranging. Here's a [URL="http://fredosaurus.com/notes-cpp/arrayptr/23two-dim-array-memory-layout.html"]nice diagram[/URL]. | |
Re: A few things: <iostream.h> and <string.h> have long been standardized to <iostream> and <string>. Also, try to avoid goto if at all humanly possible. Look into a do/while loop for a cleaner way of doing what you did there. Rather than going through a system like you have there consider … | |
Re: [code] ofstream myfile (filename.[COLOR="Green"]c_str()[/COLOR]); [/code] Gives you a C style string that the method wants (with a '\0' (null) terminus). | |
Re: Try changing line 32 to [icode] while(inFile >> inValue) [/icode] and remove line 33. | |
Re: There are two options, neither of which will be a quick learn unfortunately (certainly that depends on the amount of time you are willing to put into it). The express edition offers you two options for doing GUI. The first is Win32 API which is quite powerful but can also … | |
Re: [URL="http://dinosaur.compilertools.net/lex/index.html"]This [/URL]goes very much in depth but seems to have some good background in the beginning. Lex is a specific lexer but the concepts are the same. | |
Re: The first question to ask is where do function prototypes belong? Not in main(). After that you should compare the prototype for the function list with the definition of it down below. They don't match. After that it's some minor adjustments once you decide whether you're passing the pointer or … | |
Re: street is not declared as an array. However, even if you were to declare it as such, you must declare the rows and columns at compile time. Some compilers may allow you to declare street on line 33 (technically after the time when row and column should have values) but … | |
Re: Welcome. What have you tried so far? | |
Re: [quote]So , is it means that software engineering will include programming ? [/quote] More than likely but like Salem said Software Engineering is going to teach programming as a means to an end and may teach important concepts independent of language. The overall picture will probably be more theoretical. That … | |
Re: Hitting enter finishes the copying process. Put something like cin.get() at the end of your code to get a pause effect so that you'll have more time. | |
![]() | Re: Use the button.PerformClick() method (fill in the name of your control for button). ![]() |
Re: There is nothing in first second or third when you are calling your method. Where should these values come from? I think you mean to pass them by reference, so add a & before each variable name in your prototype and function definitions (but not where you call it) For … | |
Re: [icode] char EmpName;[/icode] Char holds exactly that: 1 char. Make it into a string. | |
Re: You would need to make this a static member of a class to use it but the basic gist of it is like [code] string Formatstring(string input,int length,string suffix) { return (input.Substring(0,length)+suffix); } [/code] | |
Re: I believe it's a non-standard BGI function from Borland's library. It's probably not going to be included with the Dev-C++ gcc. | |
Re: cost isn't initialized in that function. If you get to the else section of the if clauses then you won't assign cost and you will return garbage. | |
Re: @tetron Some additional material for this thread can be found [URL="http://www.daniweb.com/forums/thread262159.html"]here[/URL] as well | |
Re: Hotdogstand is your class, so it's a type. It's not int Hotdogstand[] it's gotta be of type Hotdogstand[]. [code] void HotDogStand::JustSold(int DogCounter, int numCarts, int HotDogStand[]) should be void HotDogStand::JustSold(int DogCounter, int numCarts, HotDogStand CartSales[]) [/code] and you have to pass in CartSales (no brackets) when you call the method … | |
Re: Your algorithm is missing a piece I think it should be [code] if (f(x)*f(a) <0) //sign change between a and x, dump right half b=x; else if(f(x)*f(b)<0) //sign change between b and x dump left a=x; else //no change no root break;//we got it [/code] That being said, I only … | |
Re: Use some of the methods from iomanip ([URL="http://www.cplusplus.com/reference/iostream/manipulators/"]#include <iomanip>[/URL]). Pay particular attention to "fixed" and "setprecision," they'll give you what you need. | |
Re: i never changes within your while loop on line 25, so you're always stuck at 0 < 1 and it loops forever. | |
Re: In Solution Explorer right click on your project name (in bold print), go to Add.. /New Item and select header file. If Solution Explorer is not visible go to View/Solution Explorer. [quote]Visual Basic C++ 2008. [/quote] We went over this already that is not the name of it. You either … | |
Re: See [URL="http://msdn.microsoft.com/en-us/library/bb773454%28VS.85%29.aspx"]this[/URL] at MSDN. Aside from their void main(argh) you can probably adopt the example they have there (you can leave the TCHAR in as it resolves to the type of the character set under which you are compiling, e.g. char for ASCII). Just make a string of all the … | |
Re: The best way in your case (with the .NET) is to create 2 timer objects, one for the "background" animation and one to pace the foreground changes. You can have two methods, one in each of the timers (one for drawing the foreground elements and one for the background) that … |
The End.