3,183 Posted Topics
Re: > at link is showed input/output of function but no pseudocode to implementation .-. useless... And in *this thread* (the 4th post, to be precise) is a full working implementation. Hmm... > also find some code for ftoa() but there is some bugs or what... ftoa() is a significantly more … | |
Re: > instead of all that shifting I just store it in a char array then xmit the array This introduces a portability issue that doesn't exist with shifting (ie. byte order), though whether that matters to the OP hasn't been established. | |
Re: > how to run the c program on note pad shall any one give me answer You don't run a C program from notepad. Notepad is a text editor and nothing more. What you need to do is write your code with a text editor, then compile it using a … | |
![]() | Re: Some compilers will add a pragma that allows you to do this, usually with the name "pack". Here's one for [Visual Studio](http://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx) and one for [GCC](http://gcc.gnu.org/onlinedocs/gcc/Structure_002dPacking-Pragmas.html). ![]() |
![]() | Re: > After his posts, see nobody is replying in this post, not even npcomplete who was helping me a little bit. After np_complete's posts, you appear to have done nothing except ask for more hints. Why should others try to help you when you clearly ignored the one who did? … ![]() |
Re: > Can't we assign the value returned by asctime() to a string? You can, but asctime() uses an internal buffer for the string, so it would be wise to make sure that a copy is made: #include <cstring> #include <ctime> #include <iostream> #include <string> using namespace std; int main() { … | |
Re: > For now, my lecturer gave me an idea to improve existing OCR by creating some machine learning languages to improve the accuracy of OCR tools. This however is on dual mode where both 'research/development' is involved. Were you under the impression that computer science research *didn't* involve some development? … | |
Re: I'm not entirely sure what you're asking, but it sounds like you're questioning how malloc() works. In fact, it requests free memory from the operating system. Assuming the OS grants that request, malloc() now owns the memory and can do what it wants. Likewise, if malloc() succeeds then your program … | |
Re: You have a `cin >> yearsLived` between the two getline() calls, which means the second call succeeds immediately on the newline left in the stream by the intervening formatted input. It's basically the problem described [here](http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream). | |
Re: This is a classic example of binary searching. The appropriate solution for your computer is to guess at half the range every time. So the guess is always half way between the previous guess and the end of the range. When the guess is lower, set the bottom of the … | |
Re: I'll give you a hint: check your array indices where the element is being set to 0. You're overrunning one of your arrays and count happens to be at that address. | |
Re: I have a better idea. How about you cut out all of the extraneous crap from your program such that only the absolute bare bones code is needed to illustrate the problem you're having and the question you want answered. Then post the code directly. Since you want to attach … | |
Re: `i` isn't 0, so the first part of the logical AND succeeds. `i` is then incremented. Next `j` isn't 0, so the second part of the logical AND succeeds. `j` is incremented. The OR part of the test isn't performed due to short circuiting and `m` is set to a … | |
Re: > Can someone help me with simple code? I made software and I want to add option that can change languages. Yeah, that's *not* simple. Internationalization and localization are rather difficult, especially if you want to support widely variant languages like English and Arabic. Give [this resource](http://msdn.microsoft.com/en-us/goglobal/bb688096.aspx) a look through … | |
Re: How do you become a good tennis player? By studying good tennis players, doing endless drills, and playing lots of tennis at a high enough level to give you a challenge. Programming is no different, though in my experience tennis drills don't really help the coding skills. Do you have … | |
Re: You should be using floating point variables if you need precision below 0, otherwise all of your weights are going to be 0. | |
Re: Have you tried searching for those terms in google? | |
Re: > Does the former mean incrementing the address of the pointer ? When pointers are involved there are four distinct values: 1. The address of the pointer object itself. 2. The value of the pointer, which happens to be an address. 3. The address of the pointed to object. 4. … | |
Re: The 2 byte bit pattern of 512 is **0000 0010 0000 0000**. The 2 byte bit pattern of 514 is **0000 0010 0000 0010**. The one byte bit pattern of 2 is **0000 0010**. You do the math. ![]() | |
Re: You keep resetting iResult in the inner loop when it shouldn't be modified. This is correct: int iResult, iCount; for(iResult=0; iResult<=iRows; iResult++) { for(iCount=0; iCount<=iResult; iCount++) printf("*"); printf("\n"); } Also notice that I added braces around the outer loop. While you can omit the braces if the entire body of … | |
Re: > the more declarations ,the more momory it takes in RAM?? The usual situation is that each process is given a certain amount of stack space that the program can use for things like local variables and function call frames. Assuming those integers are stack objects then they'd be rolled … | |
Re: Assuming that `ptr` is a pointer to a function, there's no difference. There are only two things you can do with a function: take its address and call it. Because of this limited operation set, the compiler can guess what you want to do from the context. If you're not … | |
Re: The first warning tells you that isNULL is a pointer yet you're using it like it's not. This suggests a bug wherein you forgot to dereference the pointer. You're also using strcmp() incorrectly; it returns a comparison result rather than a boolean, where 0 means equality: if (strcmp(data, "NULL") == … | |
Re: I wouldn't use bool for a bitset of error flags, but that approach isn't bad. In fact, iostream implementations will typically use it for the error state of a stream. What kind of errors are these? Have you considered exceptions? | |
Re: > so anyway no option to get stream from the keyboard? No portable option. There are non-portable options, but we kind of have to know what OS and compiler are being targeted before any viable options can be suggested. | |
![]() | Re: http://www.ics.uci.edu/~eppstein/161/960109.html That should help you boil it down to the task of handling matrix multiplication. |
Re: Um...have you considered calling Add() in a loop from 1 to 100? | |
Re: It wouldn't work without an emulation layer or cross compiling with a Windows target. The format of object code files is different between Linux and Windows. | |
Re: I'm also unable to reproduce the problem. I hate intermittent issues, they're so hard to troubleshoot. :( | |
Re: > Can C pass by reference? No, but you can fake it with pointers. > Is there something about structs C doesn't like because everywhere my sruct is used it gives an error. C requires that structure names be qualified with the struct keyword. So while you can do this … | |
Re: It's pretty easy, if a tad obscure for those unfamiliar with locales in C++: #include <iomanip> #include <iostream> #include <locale> using namespace std; int main() { struct group_facet: public std::numpunct<char> { protected: string do_grouping() const { return "\003"; } }; cout.imbue(locale(cout.getloc(), new group_facet)); cout << fixed << setprecision(2) << 10000.00 … | |
Re: > I have made it through only part a. Then please post the code to prove you've done it. Our rules clearly state that we require proof of effort on homework. > b) allow user to print array in ascending or descending order. I imagine either you've learned about bubble … | |
Re: > If I were to implement this into the code I already have where would I put it? It's a replacement for your code. > Will your code work for asking the user to input the .txt file of their choosing? No, you'd need to add that part. Though it … | |
Re: Please don't just post your homework assignment in the expectation that someone will do it for you. We require proof of effort, and then provide *help*, not free solutions for lazy people. | |
Re: I'm guessing this is for an [arbitrary precision math solution](http://lmgtfy.com/?q=C%2B%2B+arbitrary+precision+arithmetic)? If so, have you don't any research at all? Do you have a rough idea of how you want the "system" to work? And by how you want it to work, I mean more than the vague concept of "using" … | |
Re: TextChanged fires every time the value in the text box changes, so if you don't want to have a message box each time you press a key, you probably want to use something like a Leave or Validating event rather than TextChanged. | |
Re: > You cant just use gotoxy(num, anothernum); and increment or decrement them in the for(int i) loop?? What if gotoxy() isn't supported by the compiler? | |
![]() | Re: > What is this code trying to so ? It's trying to create a simulated 2D array without calling malloc() for each row but still allow array indexing for both dimension. Let's say you want a 2D array, but the size must be a runtime value. malloc() is essentially your … |
Re: > I am not getting the reason for this error and how to rectify it. A segmentation fault is when you try to access memory outside of your address space. It's nearly always caused by dereferencing an invalid pointer address or using an out of range index for an array. … | |
Re: > Will i have two executables. Each for an environment? Yes. Technically you could write an app for one environment and rely on emulation like Wine for running on the other environment, but if you want native support then there will be two executables. > Do i have to write … | |
Re: > Does the number of functions in a program affect performance? It can. There's a certain measure of overhead in calling a function at runtime. > Is writing a lot of functions in a program a good practice? Not if there's no reason for writing "a lot" of functions. Programs … | |
Re: > i would like to know is there any advantange or necessity for having loops in a linked lists. Well, a circular linked list is itself a loop, and they're quite useful. Internal cycles strike me more as a bug or faulty logic (hence the need for detection algorithms), but … | |
Re: Your output would be correct if you printed `sec` as the number of seconds instead of `RemainderOfSeconds`. `RemainderOfSeconds` isn't meaningful anyway because you throw away the difference between hours and minutes. Using your example numbers, what is `20000 % (5 + 33)` supposed to represent? | |
Re: Our rules clearly state: *"**Do** provide evidence of having done some work yourself if posting questions from school or work assignments"*. | |
Re: It seems like a better solution would be to edit the C++ code to accept input and output file names from the calling process, or run the whole thing in a loop a requested number of times from the calling process. | |
Re: What browser are you using at work? Are cookies enabled? | |
Re: It really depends on what you enjoy, but if you're just trying to get into programming as a career then it would be wise to take what you can get and use that to build up experience. Once you have a little more experience you can make educated choices as … | |
Re: At least we're closer to completion of this feature, if the read status is only inaccurate from the homepage but works from forums and categories. I'll be doing training next week, but will definitely make some time to look into this (hopefully!) final piece. | |
![]() | Re: > Im pretty confused over bool functions too. They're functions that return a boolean value. Really not that different from a void function except for the return value. > Apparently the program runs through the bool enqueue function twice. If array size is 0, the next positive input will cause … ![]() |
Re: > Why is the code not swapping names?? Because you're not swapping names. You're not even swapping Students. You're swapping local references (copies of references that are passed to swap()), which ultimately doesn't change the original references. |
The End.