6,741 Posted Topics
Re: >Here's one possible way to get desired string2: It's generally considered rude to provide a complete solution when the OP hasn't shown any proof of effort. >#include<iostream.h> This header is no longer valid C++. Many newer compilers will refuse to compile it, and some of them have done so for … | |
Re: >Does it have something to do with the braces being gone off of the else? You got it in one. If you omit the braces, only the next statement will be a part of the block. If you add braces in the way that your compiler parses the code, it … | |
Re: Yes, though I get the feeling you were trying to reply to a thread and accidentally created a new one. Look up the stringstream class. | |
Re: >I know there must be a way to do it... There's not a way to do it. Structures have a set size at compile-time. However, I get the impression that you simply don't know how to express your problem and ended up asking for something impossible. It looks like you … | |
Re: >how can one find the upper limit of an array? Assuming the upper limit in terms of capacity, you can use the Length property. my_array.Length gives you the number of items the array can hold, and my_array.Length - 1 gives you the last valid index. >ow can one change that … | |
Re: And what do you want us to do? We're not going to write this program for you, so if you want some help, you'll need to show that you've made an attempt. | |
Re: >how it is possible to remove "dublicates" from Values(6) ? I'd start by sorting the vector and calling std::unique on it. Of course, that's mentally translating "dublicate" into "duplicate". If you really do mean "dublicate", I have no idea what you're talking about. | |
Re: Daniweb isn't your personal homework service. Go to rentacoder.com if you want cheap labor. | |
Re: So...did you even try to understand and correct the errors you're getting before posting all of that (without code tags)? | |
Re: >iMas=new int(m); You need to use square brackets instead of parens: [code=cplusplus] iMas=new int[m]; [/code] >for (int i=1; i<=m; i++) Arrays are zero-based in C++. That means you start at 0 and stop at n - 1 or you'll be accessing memory that you're not allowed to access: [code] for … | |
Re: Your code doesn't properly handle negative values, amitahlawat20. | |
Re: Not portably. If you want to know about non-portable methods, tell us your OS and compiler. | |
Re: Thanks for the tips. However, I'm going to disagree with them to an extent. >How to make your program to be fast. Don't waste your time with micro-optimizations. Instead, focus on algorithms and I/O. That's where the big wins in performance are found. >1. Use Pre Increment or Pre Decrement … | |
Re: You can use the Application class from System.Windows.Forms (assuming we're talking about C++/CLI): [code=cplusplus] Application::Exit(); [/code] | |
Re: You have a type mismatch: [code=cplusplus] RvX += RotMatrixX[i][k] * vec[k]; rvec[i] = RvX; [/code] In the first line, vec[k] is a vector, not a float. There's no defined conversion from vector to float in your code, and you don't define a specific operator* to handle (float * vector). Most … | |
Re: We have a list of recommended books [url=http://www.daniweb.com/forums/thread70096.html]here[/url]. | |
Re: For starters, you aren't properly initializing your row and col data members. Second, you aren't properly copying your objects and end up trying to access freed memory. | |
Re: >i.e. * before / etc Multiplication and division have the same precedence. >i dont know how to get the code to look at each operand in a string of chars. You would save yourself a lot of trouble by using a stack to either build a parse tree, or convert … | |
Re: Is this a compilation warning or error? I'm not sure I understand what you mean by "I get this file popping up...". | |
Re: You might as well be speaking gibberish if you don't provide the context for your question. | |
Re: >I have posted 3 threads requesting help on reading floating >point values from a binary file but did not get any reply at all. So you've flooded the forum with threads asking the same question? That alone will cause people to ignore you. >Following code just throws an exception What … | |
Re: >Something I have noticed with my uni course is that there are so few women on it. That's typical. >Is there some reason why women stay away from the >best part of using a computer IE programming in java? Maybe they don't know that the best part of using a … | |
Re: >Is it possible to make a function with an unknown number >of parameters without knowing ANY of them? No, C++ requires at least one non-variable parameter so that the stdarg macros know where to hook the beginning of the parameter list. >doesn't make sense that this functionality has been removed … | |
Re: [url]http://msdn2.microsoft.com/en-us/library/z2kcy19k.aspx[/url] | |
Re: When I write a Windows Service, I typically use XML configuration files for communication between the service proper and any auxiliary applications (such as detailed configuration of the service). | |
Re: >Should I use an array to do this? Sounds good to me. You need to store the count somewhere, and an array keeps the three counts neatly organized under one object. | |
Re: >Why do we use memory heap to allocate classes, but not built-in types (int, char etc.)? Bad question. Sometimes objects are better placed on the "stack", and sometimes they're better placed on the "heap". Provided the language doesn't force you into one or the other for internal reasons such as … | |
Re: 1) I'm not sure what you're asking. Are you talking about hiding a variable by using another variable of the same name in a nested scope? [code=c] #include <stdio.h> int main ( void ) { int foo = 10; { int foo = 20; printf ( "foo = %d\n", foo … | |
Re: >I've missed something somewhere that tells us all about reputation. To the best of my knowledge, the only explanation about reputation is by Dani, in the feedback forum, in direct response to a confused poster who couldn't find an explanation about reputation. ;) I still don't understand the details myself. | |
Re: >How can i write comment in professional way to explain my code Copied from my reply to a similar question on cprogramming.com: The way I explain commenting to my team is that any given piece of code causes you to ask one of three questions: 1) "What is it doing?" … | |
Re: >use selsort "How do I cross this creek without getting my feet wet?" "Use a 747 to fly over it." | |
Re: >wouldn't it qualify as libel instead? Libel is written, slander is spoken. But I'm more inclined to treat a forum discussion as a spoken exchange, thus slander is the correct term in my opinion. | |
Re: What have you tried? This is a very basic and simple program, so you're expected to at least have something resembling a solution. It doesn't have to work, but it does have to look like you tried. | |
Re: >What enables C to support variable number of function arguments (varargs) Usually arguments are placed on a stack, and by knowing how that stack is organized, the compiler writer can write macros to iterate over the arguments. It's actually pretty simple, but very non-portable. >What is special in C which … | |
Re: Let's start with the first problem and see how that goes. Unless you're using a compiler that supports export (you probably aren't), templates can't be split into separate declaration and definition files. You have to provide the definition of the template in the header. | |
Re: Life isn't fair. Personally, I'm wondering why you chose CEOs to bash for making obscene amounts of money and not professional athletes or actors. | |
Re: FYI, this type of post is a good way to be ignored: [quote] can you help me? <complete text of a homework assignment> [/quote] It suggests that by "can you help me?", you really mean "can you do it for me?". We're not a homework service, so prove that you've … | |
Re: [url=http://eternallyconfuzzled.com/arts/jsw_art_bigo.aspx]This[/url] might help you get started. Little-o isn't used very often in computer science, so you'll find yourself sticking to just O, Omega, and Theta. | |
Re: What do you know about working with bits? Do you know how to set them and shift them? | |
Re: >You should return NULL (in CAPITALS), then it should return 0 No, you shouldn't use NULL except in a pointer context because it's allowed to be (and often) defined thusly: [code=c] #define NULL ( (void*)0 ) [/code] If you want to return a null character, return '\0'. | |
Re: >Is the advice different for devices that do not necessarily have an operating system. Freestanding implementations are excepted from a lot of the rules of hosted implementations. But since a programmer on a freestanding implementation is highly unlikely to be asking this question, and int main is always correct, the … | |
Re: >i am confused what do i need to return?? It returns DataType. DataType is the type of the data that the list holds, so you'd return the data at the Nth node. Using your notation: [code=cplusplus] template <class DataType> DataType OrderedList<DataType>::get(int n) const { NodePointer nPtr = first; // Find … | |
Re: Pure speculation, but maybe 10 grades per line, 5 lines per field, and each field separated by a blank line: [code] x x x x x x x x x x x x x x x x x x x x x x x x x x x x x … | |
Re: >You're comparing colorCode to a character but defining colorCode as an integer! Not a problem. char is an integer type and int can hold any value in the basic character set. | |
Re: >inFile.open("input.txt"); >outFile.open("output.txt"); Let's start here. You're not checking to see if the files were opened successfully. All kinds of gremlins can pop up if you use a file stream that failed to open. >//Read input file and store into array >while(gradeArray[i] != SENTINEL) You never initialized gradeArray, so gradeArray[i] is … | |
Re: [url]http://msdn2.microsoft.com/en-us/library/aa364963(VS.85).aspx[/url] | |
Re: >ON another note this is depreciated. Do you mean deprecated? If so, you're wrong. If not, please elaborate. | |
Re: That looks like a healthy mix up of scanf and printf. Why are you trying to do padding in scanf? That code is actually quite awful, so you probably want to redesign and rewrite it. I get the impression that this isn't your code, so I'll give you a better … | |
Re: >What is the output for a and b? Run it and see. >Why is a 3 and b 2 is this one 2 + 3 = 5 5 - 3 = 2 5 - 2 = 3 | |
Re: >What I want to do is to put each line into an Array. [code=cplusplus] array<System::String^>^ a = gcnew array<System::String^> ( textBox1->Lines->Length ); a = textBox1->Lines; [/code] |
The End.