6,741 Posted Topics
Re: >double Net(double n,double *i); >double Pension (double *p, double n); >double taxable (double *t, double i, double n, double p); >double taxdue (double *td, double *t); These aren't function calls, they're function declarations. You call those functions like so: [code=c] Net ( n, &i ); Pension ( &p, n ); … | |
Re: Holy crap, it feels like every question these last few days has been about runtime sized arrays. :icon_rolleyes: >But it does not work. Right. C++ requires that the size of an array be a compile-time constant. You can't use the value of a variable unless it's also declared const. The … | |
Re: [code=c] void foo ( int a[3][3] ); int main ( void ) { int a[3][3]; foo ( a ); } [/code] If you want a better answer, ask a [URL="http://www.catb.org/~esr/faqs/smart-questions.html"]smarter question[/URL]. | |
Re: Hopefully a failing grade will teach you to pay attention in class. | |
Re: Why are you trying to convert to a static array? The dynamic array is much more flexible, seeing as how you don't know how many records will be read from the file. It seems to me that you're taking a giant step backward in robustness. You might notice this robustness … | |
Re: If you didn't bump it back to the top of the thread list, nobody would ever see it again. | |
Re: >none of the opponent ideas has changed my thoughts. Do you want a cookie or something? >i am not a cheater because i say cheating must be supported legally Wait, let me get this straight. You support cheating as being the most ethical thing, but you turn around and say … | |
Re: Assuming you're working on Windows, learn about the PE (portable executable) file format and you can easily extract the information you want either manually or with any number of disassembly tools. | |
Re: static_cast is [B]designed[/B] to painful, which encourages you to avoid casting when you might otherwise say "why not?". Another reason I've heard is that it's easier to search for a cast, while the (type) pattern is also seen in non-cast syntax. I have yet to see a case where I've … | |
Re: >What is the difference between a well-formed XML document and a 'valid' XML document? Well formed XML is syntactically correct (ie. a parser won't choke on it) and valid XML is semantically correct based on a provided schema. See [URL="http://www.w3schools.com/Xml/xml_dtd.asp"]here[/URL] for more details. | |
Re: There are two generally accepted ways to split a number into digits. First is the string conversion: [code=c] #include <stdio.h> int main ( void ) { int value; printf ( "Enter an integer: " ); fflush ( stdout ); if ( scanf ( "%d", &value ) == 1 ) { … | |
Re: delete frees the memory up for other uses. Just because that memory isn't immediately used after deleting doesn't mean you can safely access it. | |
Re: >Come on man,I considered c++ programmers smarter. In my experience C++ programmers are just like everyone else: the majority are slightly below average, a smaller number are average or just above, there are enough retards to frighten you, and a handful are truly brilliant. By the way, you're not that … | |
Re: >Can you see what I'm trying to do? You're trying to use the same function to properly handle two incompatible types. A three dimensional array is not the same as a pointer to a pointer to a pointer. A template is the ideal solution for this problem, assuming you can … | |
Re: >why dont you learn more common php or asp.net instead of cold fusion? Because he already knows PHP and ASP.NET? Because his employer requires him to learn ColdFusion? Because there aren't as many ColdFusion programmers and he could make bank by becoming one? Because he's simply interested in it and … | |
Re: Okay Caleb, or Claire, or whoever the hell you claim to be, let's keep [URL="http://www.daniweb.com/forums/thread181971.html"]IDENTICAL FREAKING QUESTIONS[/URL] to a single thread, mkay? | |
Re: Posting your assignment is more likely to attract flames than any useful help. Daniweb is not rentacoder. | |
Re: >How complicated should a program be for you to >make plans for it (eg. flowcharts, drafts, etc)? Anything more complicated than the hello world program. >When do you just jump into coding with just a vague >idea of how a program is supposed to run? When I'm prototyping. However, for … | |
Re: You're asking in the wrong place. Daniweb is for people who do their own work. | |
Re: Amazing. Visiting the Geeks' Lounge is like sitting in a room full of children. | |
Re: If you're sure the problem really has been solved, you can contact a moderator in that forum. We're able to set threads as solved if necessary. | |
Re: You xpath isn't returning the parent at all, it's returning the matching elements with that text. Because multiple elements match the criteria, you get multiple results for each parent element. If you return the parent itself, you'll only get one result: [code=xpath] //year/*/*[contains(., '$string')]/parent::* [/code] | |
Re: >I don't get anything back from selectNodes. Because what you're asking for isn't what you intended to ask for. Let's break it down: >//book[@id='bk102'] This is okay, it selects the book element with an id attribute that matches the string 'bk102'. So far so good. >//book[@genre ='Other'] book doesn't have … | |
Re: >int size=0; >int *parr= new int[size]; For starters, size isn't a compile-time constant, which means you're relying on a compiler extension and your code is thus non-portable. Next, an array of zero size is unlikely to be what you want. The error you're getting generally means that you've written outside … | |
Re: You define MARITALSTATUS twice before passing to FEDTAX: first as a global int, then a local char in main. You also redefine it [i]again[/i] in your FEDTAX function, which means the value you passed will never be used. These problems alone should be enough to cause you fits. Also make … | |
Re: >Thank you for your help. You neglected to ask a specific question. Allow me to show you what your "question" looks like to me: [quote] I have this program that works but my teacher wants me to do it without using globals. Do it for me and give me the … | |
Re: [code=c] int i; for ( i = 0; subjeCode[i][0] != '\0'; i++ ) { if ( strcmp ( subjeCode[i], input ) == 0 ) break; } if ( subjeCode[i][0] != '\0' ) { /* Found */ } else { /* Not found */ } [/code] | |
Re: >What do you mean, the "SQL end"? Or "the application end"? >I don't understand those terms. I think they're rather self-explanatory. Are you being intentionally obtuse again? >Do I have to program those SQL files on the aplication end, or on the SQL end? You program them wherever you want, … | |
Re: You have the right idea, though the actual code you posted won't compile. I'd give you an example, but I can't do so without solving the problem for you, sorry. | |
Re: >should I put the starting bracket on the next line Whichever you find easier to read. >should I use ++i or i++ For built-in types, it doesn't matter. For user-defined types, the prefix increment is preferred. If you have trouble remembering that guideline, always use the prefix form when the … | |
Re: The map class uses an overloaded operator< for maintaining the relation between keys. Your Student class doesn't have this overloaded operator. That should give you a starting point for researching a solution. | |
Re: >Then, you could define 4 derived classes, "SpadeCard", >"HeartCard", "DiamondCard" and "ClubCard". You really think a class for each suit is necessary? Do you suggest making a separate class for each value too? :icon_rolleyes: There's not enough complexity in a standard deck of cards to justify inheritance, so perhaps the … | |
Re: I think you're asking the wrong question. The right question would be (assuming 8 byte doubles), why are you trying to eat over [B]16 gigabytes[/B] for a single vector? The naive approach isn't likely to work in this case, you need to consider alternative algorithms that don't waste so much … | |
Re: I believe niek_e was suggesting you show us where the demand for a new forum is. If we added a specialized forum at the whim of every noob with a new hobby, Daniweb would become so diluted as to be useless. | |
Re: >The point I want to make over here is, can't we have some >auto-marking mechanism for threads which identifies the time the >last post was made onto a thread and if this is more than some >pre-specified value mark the thread as "solved". What makes you think the new member … | |
Re: >dunno where to start This means you're overwhelmed with the complexity of the task. Break it down into smaller, simpler tasks until you aren't overwhelmed. Then solve them individually and put them together to get the final program. | |
Re: It looks like you're confused about the arrow operator. This: [code=cplusplus] pointer_to_struct->member [/code] is equivalent to this: [code=cplusplus] (*pointer_to_struct).member [/code] It's just a convenient notation for merging a dereference and member access into one. | |
Re: Pascal's triangle is boring. How about something more fractalish: [code] #include <iomanip> #include <iostream> using namespace std; int main() { int rows = 16; for ( int i = 0; i < rows; i++ ) { cout<< setw ( rows - i - 1 ) <<""; for ( int j … | |
Re: Code is worth a thousand people jabbering about how a program works. | |
Re: >Is this valid?.. #pragma warning(disable:'warn code') ..:p If you don't know what's causing a warning, you'd be a fool to disable it. I only know of one warning, on any compiler that I've ever used, where I'm 100% sure that it can be safely disabled. The correct response to a … | |
Re: You can, but you'll probably get a conversion warning and the result will be forced into a boolean range (in the case of int, zero is false and non-zero is true). | |
Re: That's what this forum is for. An added benefit is you have many people with different experience and perspectives who can help you and keep each other from making mistakes when helping you. | |
Re: You can't assign to arrays like that. In this case you're pretty much stuck with copying the contents of the string literal to the array manually or with a function like strcpy that does it manually: [code=cplusplus] #include <iostream> #include <cstring> struct StudentRecord { char Name[20]; // (1) int ID; … | |
Re: Cast it: [code=cplusplus] #include <iostream> void f(int* x) { std::cout<<"int*\n"; } void f(char* x) { std::cout<<"char*\n"; } int main() { f((char*)0); f((int*)0); //f(0); } [/code] | |
Re: I'm not sure I understand the question. Are you trying to find our first posts on Daniweb, or are you asking why we didn't first post to the Geeks' Lounge? | |
Re: If you're struggling, duplicate your declaration: [code] void foo ( int *arg[2][3] ); int main ( void ) { int *ptr[2][3]; foo ( ptr ); return 0; } [/code] Within foo, you use arg just as you would use ptr unless you're trying to use sizeof, in which case you … | |
Re: Agreed. Moved to Windows forum. | |
Re: & applies to the type, not the name: [code=cplusplus] int& dequeint::pos(void) [/code] | |
Re: >What do you think I should do? I think you should stop being so afraid of your direct supervisor and confront him with your concerns. I mean really, what do you expect us to do about it? If someone is supposed to train you and isn't, that's negligence on his … |
The End.