6,741 Posted Topics
Re: [QUOTE=mazhar1986;1693162]lots of contradictory replies, which one's right?[/QUOTE] Please notify the Oxford English dictionary. "Lots" has been redefined to mean "two". :icon_rolleyes: But given cscgal's track record with this site, I'd lean toward her opinion of having great content and letting the backlinks handle themselves...even if it [I]didn't[/I] seem otherwise obvious. | |
Re: >It works fine as for(i=1;i<=n;i++) . Yes it does. But then again, so does this: [code] i = 9; loopie: // Do stuff if ( --i > 9 - n ) goto loopie; [/code] Most programmers prefer to use the idiomatic approach because it's easier to use, easier to get … | |
Re: >void StringSearch(char String[], char Ch, char *Ptr); The first rule of simulating pass-by-reference using pointers is that if you want to change the value of an object, you pass a pointer to it. You want to change the value of the pointer, not the character being pointed to, so you … | |
Re: There are several ways. Not to mention that graph algorithms tend not to be trivial, so you'd be better off studying existing solutions, like Prim or Kruskal's algorithms. | |
Re: Reverse your order of opening. Open the main form (but don't show it). Then from the main form's load event open the login form. If the login is valid, show the main form and close the login form. If the login is invalid, do an Application.Exit() or close the main … | |
Re: Faster how? Compiles faster? Links faster? Generates faster machine code? You have to be more specific, and even then you'll probably get a bunch of people spouting benchmark nonsense. The best way to find out which compiler suits your needs is to test them all on the system in which … | |
Re: >Just interested in the different methods everyone >uses to plan their projects, set timelines, etc. What is this planning thing you speak of? Just kidding, I use a variation of Scrum that's optimized for small teams. | |
Re: >is there any way by which i can store more no. of digits. Are you using C or C++? If C++ then an array should be avoided in favor of a standard container that grows dynamically, such as std::vector. If C then you need to simulate your own dynamic array … | |
Re: There are two steps. First, use the uint type. Second, validate the input string against the uint type before saving it: [CODE] uint value; Console.Write("Enter a positive integer: "); while (!uint.TryParse(Console.ReadLine(), out value)) Console.Write("Invalid input. Enter a positive integer: "); numbers[I] = value; [/CODE] | |
Re: Please prove that you've made an honest attempt to do it yourself. | |
Re: >I can't find any way around it because System::string >has no stringstream, or any ostringstream. You probably don't need a string stream. System::string is a surprisingly robust class that can probably handle what you want to do in a slightly different way. Perhaps if you described the problem you want … | |
Re: >Any instructions on the web? I cannot find any. I could. Strangely enough, they were on the Toshiba support web site. :rolleyes: Rule 1) If it's not easily accessible and you aren't well versed in how to do it, don't screw around. Toshiba recommends that you send in the computer … | |
Re: [QUOTE]So lets say you are given 10 seconds to answer the question and every correct answer adds you 10 seconds. How would i implement this?[/QUOTE] The simplest approach would have you checking the difference of the time between the point where the question is displayed and the point where the … | |
Re: I'm working on a PDF417 recognition and decoding library for iOS. | |
Re: >I have a variable: >char *insert = "abcdefgh" >and i want to split that into chars like so, 'a', 'b', 'c', 'd', etc. Uh, you're done. A string literal is an array of const char and except for modification, sizeof, and address-of you can use the pointer as if it … | |
Re: >I got the method down here (for the first integer): Why not write it generally for all integers? [code] public int reverse_integer ( int val ) { int ret = 0; while ( val != 0 ) { ret = 10 * ret + ( val % 10 ); val … | |
Re: This is a common test question. Have you tried to solve it yourself? Here's a hint: you can move data as well as change links. | |
Re: [QUOTE=Aniqa Shaikh;1092365] Atleast u'll not have to waste time like i did!!!! [/QUOTE] How can it be a waste of time when you learn how to do something? You're basically just preemptively doing everyone's homework for them with this code snippet (seeing as how this program was homework, judging by … | |
Re: The question is binary in the majority of cases: you either have a degree or you don't. Your GPA and grades in the process of obtaining a degree are largely irrelevant after graduation. | |
Re: You should search the forum before asking a question that's been [thread=11968]asked before[/thread]. | |
Re: Given that at least Ideone has an API, that's not an unreasonable suggestion. Though many (if not most) code blocks on Daniweb are not meant to be compilable as-is, so the best fit for such a feature would be in our code snippets rather than discussion threads. | |
Re: Why don't you post the code you've tried that doesn't work? We can show you where the problem is. | |
Re: [QUOTE]Can anyone explain -in simple words as possible- what happens in the first code so that it prints the result that way?[/QUOTE] [URL="http://en.wikipedia.org/wiki/Undefined_behavior"]Undefined behavior[/URL]. | |
Re: graphics.h is certainly a problem, why do you use a graphics library from two decades ago? | |
Re: [QUOTE]I just want to hear from members who has experience in industry as well as students of the forum what do you think about this?[/QUOTE] What do we think about [i]what[/i] exactly? It comes as no surprise that the application side is growing more quickly than the systems side, and … | |
Re: [CODE]#include <cstdlib> // I'm needed for rand() and srand() #include <ctime> // I'm needed for time() #include <iostream> int main() { // Put me at the start of the program srand((unsigned)time(0)); const int N = 100; // Watch as random numbers between 0 and N are generated for (int i … | |
Re: [QUOTE]my friend need it for him to land a job..[/QUOTE] If your "friend" can't answer the question without help, he [I]shouldn't[/I] get the job. Also note that confusing both parentheses and braces for angle brackets is a sure way to not get hired for any job that requires even the … | |
Re: [QUOTE]Yes, i want the space to be inserted when you press enter, without jumping to the next line. And when the maximum number of columns in a row is reached, it should jump on to the next line ie. the new row....[/QUOTE] Assuming you want the console to auto-format itself … | |
Re: Please provide some new information to justify a second thread on the topic. | |
Re: >extern char* delete_space_from_string ( char *string /* I */ ) extern is redundant. All function declarations are extern in C by default. >if ( string == NULL || *string == NULL ) NULL should only be used in pointer context: [code] if ( string == NULL || *string == '\0' … | |
Re: [QUOTE]Obviously I have some wrong assumptions, because this prints "strsize = 8" no matter what.[/QUOTE] Good call. buff is a pointer to char, so sizeof(buff) will always tell you what the size of a pointer to char is, not the length of the string it points to (if it points … | |
Re: [QUOTE][CODE]pStu= new (nothrow) student pStu[i];[/CODE][/QUOTE] Should be this: [code] pStu= new (nothrow) student[i]; [/code] You also need to include <cstdlib> because that's where system() is declared. | |
Re: [QUOTE]Only one problem, what is a masked text box?[/QUOTE] Here's a hint for the future: always try to research things like this on your own first. The only if you come up with nothing or fail to understand what you've found should you ask for clarification. In this case, "masked … | |
Re: [QUOTE]Wow! I never knew it was a C function. Thanks for sharing that, now onward i will not use that.[/QUOTE] The fact that it's a function inherited from C is largely irrelevant. The important piece of information is that gets() is quite literally impossible to use safely. There's always a … | |
Re: [QUOTE]Can anyone explain to me in details preferable with an example the different between i++ and i++ please.[/QUOTE] The standalone difference is as functionally as follows: [code] // A function that performs ++i int prefix_increment(int& i) { i = i + 1; return i; } // A function that performs … | |
Re: >Is there any way , memory leaks can be clogged in c/c++ ... Knowledge and discipline. If you're aware of how memory leaks can come about in your project and apply a disciplined approach to avoid them, that's all you need. >Are there any good tutorials on how can we … | |
| |
Re: [QUOTE]If it is because of undefined behavior then how every time answer is coming as 7 6 7.[/QUOTE] Undefined is not synonymous with inconsistent. On the same compiler, undefined results could very well be the same for every run. But there's no guarantee of that, or that other compilers or … | |
Re: [QUOTE][CODE]*p ^= *q ^= *p ^= *q;[/CODE][/QUOTE] This statement invokes undefined behavior by modifying an object multiple times between sequence points. While cute, the correct form of an XOR swap is as follows: [code] *p ^= *q; *q ^= *p; *p ^= *q; [/code] Notice how it's broken down into … | |
Re: Your compiler should support some form of getcwd(), check the documentation. | |
Re: [QUOTE]Isn't it should be pointing the address of variable p?[/QUOTE] You can't expect a pointer to member to be printable at all, actually. The term "address" is used to mean "reference to a location", which for practical reasons compilers have implemented as a physical or virtual memory address. However, that's … | |
Re: Is your array sorted? | |
Re: At most this would be a popularity contest, and I think that's what the OP intended. [QUOTE]Maybe you people can show some statistics in a regular basis[/QUOTE] Statistics don't say much. Going by numbers, the mod who formats and adds code tags to 100 posts had a greater impact than … | |
Re: [QUOTE]If my program doesnt use the stack or heap at all (as in me putting a new or stk()? in it) will it still have (however small) memory leaks?[/QUOTE] If you don't create leaks, or use any libraries that create leaks, then it stands to reason that there won't be … | |
Re: [QUOTE]in the end of each program, i get the message "Process returned 0 (0x0). execution time : ....... press any key to continue" How can i get rid of that.[/QUOTE] Stop running the program from within Code::Blocks. :icon_rolleyes: | |
Re: If your program uses the .NET framework then obviously that's a dependency required on the target machine. ![]() | |
Re: AES isn't especially difficult to implement from the specification. Ignoring the usual caveats of reinventing the wheel on important stuff like encryption, you could write your own class: [code] #ifndef JSW_AES_PROVIDER_H #define JSW_AES_PROVIDER_H #include <vector> namespace jsw { namespace encryption { typedef std::vector<unsigned char> bytes_t; class aes_provider { public: aes_provider(bytes_t … | |
Re: [QUOTE]Wouldn't it be better if we just defined the functions before the main function instead of having a function prototype and a function definition in separate areas?[/QUOTE] What if you want to break your program up into multiple files? What if you want to write a library that will be … | |
Re: [QUOTE]I know that with the pointer you use the "->" operator to access the object methods, and with the other one you use the "." operator, but what exactly is the difference between them?[/QUOTE] In the first declaration, [ICODE]rectangle[/ICODE] is a reference to an address where a Shape object happens … | |
The End.