1,359 Posted Topics
Re: It would help if you told us the problem that you're having, though in this case it is easy to guess. The reason that it doesn't recognize the [icode]string[/icode] class is because [icode]string[/icode] is in the [icode]std[/icode] namespace, just like the [icode]<iostream>[/icode] objects. You need to have a [icode]using std::string;[/icode] … | |
Re: The logical OR operator is a short-circuiting operator; when a true result is found in the first clause of the operation, it does not process the second clause. This applies to the clauses as a whole. Operator precedence doesn't enter into it, in this instance. | |
Re: [B]Dipak Chauhan:[/B] To start off, it is generally considered impolite to re-start an old, existing thread with a new question this way. While what's done is done, please refrain from hijacking threads in the future. Even if the question is more or less the same, when it has been more … | |
Re: [QUOTE=frogboy77;1639687]I didn't realise there was an age limit. Could you let me know what it is. I'm 3 years old by the way.[/QUOTE] While I'll admit that I'd overlooked this myself, the age limit is spelled out in the [url=http://www.daniweb.com/forums/faq.php?faq=aup]Acceptable Use Policy[/url]: [quote=DaniWeb Terms of Use][B]Minimum Age Requirement[/B] In compliance … | |
Re: Would this be a good point to mention that one usually speaks of 'assembling' an assembly language program, rather than 'compiling'? As for Visual Studio, while it is true that VS 2010 can be used as an IDE for toolchains other than the ones which come with it, there is … | |
Re: [QUOTE=jbennet;1635202]conio.h is pure evil! It not portable (only works properly under DOS) and isnt standards compliant either[/QUOTE] While I agree with you about both <conio.h> and the Turbo C++ compiler, it is my understanding that in both India and Pakistan, the university systems have standardized on Turbo C++ and generally … | |
Re: If you don't mind me asking, what compiler are you using, and what version? The console I/O library isn't a standard one (which is fortunate, as you don't actually use it and can remove it from the include list), and the modern C++ header for the standard library is [icode]<cstdlib>[/icode], … | |
Re: I'm not sure why it would give that specific error message; it is more typical of certain types of header problems. You might try using 'g++' rather than 'gcc'; by default, gcc assumes that you're compiling a C program, while g++ is specific to C++. I would also recommend always … | |
Re: What is 'correct' all depends on what you are trying to do. If you are only looking to match the first two characters, then the first one would be correct in both cases - it would match any case where the string begins with the characters 'G' and '1', regardless … | |
Re: Assuming that you're using one of the commonly used MIPS simulators such as SPIM or MARS, then the print integer system call expects the value to be printed to be in $a0, not a pointer to the value. You'll need to put the pointer to the memory location into a … | |
Re: [QUOTE=Onlineshade;1636600]Which compiler have you used? I can not run this program in Dev c++. If you tell your compiler's name I can try it. Thank you.[/QUOTE] Actually, the compiler information was provided in the comments at the top of the program: he is using gcc running under a Unix variant, … | |
Re: I think that the problem lies with the [icode]getmodelno()[/icode] function itself, and what you are expecting it to do. As it is written right now, it prints the model number to the screen, but does not return it's value. If you want the function to act as an accessor (also … | |
Re: Having tested this out, I found that the problem is in the conditional of the inner loop. As it is, it not only is skipping possible reverses because it only goes up to i, it is overrunning the end of the array. A workable solution would be for(j=0;j < n … | |
Re: Here is a simple pseudo-code which represents the logic of the problem; no guarantees are given as to it's correctness. [code]for x in range(0, 10): for y in range(0, 10): if x >= y: print("X", end='') else: print("*", end='') print("\n")[/code] (OK, so it isn't so pseudo a code, but it … | |
Re: There are many different [url=http://www.thefreecountry.com/compilers/cpp.shtml]free C++ compilers[/url] around, with the two most commonly used free ones being [url=http://gcc.gnu.org/]GCC[/url] and [url=http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express]Visual C++ Express[/url]. VC++ Express is a compiler and IDE (integrated development environment), and has an excellent debugger, but you have to be careful about Microsoft-specific extensions if you intend to … | |
Re: [b]N1GHTS:[/b] Having been there myself, I'd say that it is mostly because, to most beginning programmers, it looks like the biggest possible challenge to their skills, and the biggest ego boost around. It is also, for a handful of developers, seen as a chance to contribute something fundamental to the … | |
Re: Graphics aren't a standard part of the C++ language; in order to help, we'd need to know what graphics library you were using, and which compiler and OS you were working in as well. | |
Re: Well, aside from the fact that you don't declare the eight variables you use to get the bit values, it should work - if that's what you need it to do. However, assignments like these more often involve converting a binary number in a [i]string[/i], which works a bit differently. … | |
Re: The [url=http://www.osdev.org/]OSDev[/url] website may prove to be particularly useful. When I was working on similar plans (now long since derailed by the various intrusions of harsh reality, but my life isn't necessarily yours), they were vastly helpful, and I in turn contributed to their knowledge base as I could. You … | |
Re: Hmmn, the results were quite different from what I'd expected, for the first line in particular (I suspect my old Lisp biases are showing through on that one). I may need to go back to review certain aspects of the language. | |
Re: Hold on for a moment, though; just how are you adding the list to the SQL statement, and how are you vetting the data, if at all? Generally speaking, any data added to a SQL query programatically should be done using a parameterized query: [code] cursor.executemany("INSERT INTO table values ('?', … | |
Re: What are you allocating the memory for, and why do you need to ensure that it is cleared/populated? | |
Re: the if statements are incorrect; in Java, you cannot compare a range the way you are trying to do. This is a common misunderstanding, as it makes sense mathematically, but doesn't work in most programming languages. You need to write out a full clause on each side of the or … ![]() | |
Re: Could you start by showing us what you've already done? The heart of this problem is writing a sorting function; however, since there is a small, fixed number of items to compare, it might be easier to do it ad hoc than to write a full function. You could simply … | |
Re: The issue is that you aren't getting a string value from your [icode]Date[/icode] object; as a result, it is printing the class and hash for [icode]today[/icode], rather than an useful information. At minimum, you need to use [icode]today.toString()[/icode], which would give the time and date in UTC format; better would … | |
Re: I just tested the program as given above, using Code::Blocks 10.05 for Windows/GCC 4.4.1, and it compiled and ran smoothly. Oddly enough, it was in Linux that I had trouble - the "ansidecl.h" header file wasn't recognized, and the manual declarations of malloc() and memcpy() also presented problems, though once … | |
Re: As the problem instructions say, you need to have the second loop nested inside the first loop. in this case, all you really need do is remove the two cout lines between the loops, and move the endl off of the the inner loop's output, and you should be good … | |
Re: It isn't hard to see where the problem lies, now that we've seen the code. What's going on is that you declare the variables and define several functions in the header itself; this becomes a problem when you then #include said header in more than one compilation unit. To get … | |
Re: The first thing you need to know about assembly language is that it is specific both the the type of computer you are using, and to the operating system it is running. Furthermore, each assembler (the programs that convert assembly language programs into object code) has it's own variant syntax, … | |
Re: [QUOTE=nocloud;1583959]Making my functions inline did the trick![/QUOTE] I think you're taking away the wrong lesson, here. While making the functions inline will work, it isn't the best practice, as inlining larger functions is very inefficient in terms of space - especially if you are calling them in several places. The … | |
Re: As an aside, the textbook [i]Assembly Language Step by Step[/i] has an excellent explanation of the hardware stack. The book focuses on programming for Linux, but with a virtualizer such as VirtualPC or VirtualBox, it is easy enough to set up a virtual Linux system running inside a Windows PC. | |
Re: Given that this is a disassembly from VC++ 2010 (as noted by the reference to MSVCP100.DLL), you would expect the disassembler to be using Intel syntax, meaning that MOV operations are dest, src rather than src, dest. Thus, some of your comments are probably backwards with regards to what values … | |
Re: The problem is that you are changing the meaning of p before you test p->value, which means that you don't know yet if p (and hence p->value) is valid. You want to test q->next, not p->next: [code] while((p!=NULL)) { q=p; p = p->next; if(q->value = a) { printf("correct value\n"); p=q->next; … | |
Re: There shouldn't be any size limitations on ftplib.storbinary(), no. However, the fact that the error message is coming from the server you are uploading to, rather than the local client, implies that the problem is occurring on the server end. Looking up the [url=http://en.wikipedia.org/wiki/List_of_FTP_server_return_codes]list of FTP error messages[/url], you'll see … | |
Re: There aren't really any Python certifications at this time, at least not ones which anyone would have any reason to pay attention to; Brainbench has one, as does ExpertRatings, but I doubt that any company would really make hiring decisions based on them (while some companies do ask you to … | |
Re: > And i really don't think that THIS IS THE FRIENDLIEST IT Community. Starting off with your RUDE REPLY Trust me, had you posted to, say, DevShed with the attitude you've displayed, you would have seen what a rude reply looks like. You should thank us for our grandmotherly kindness … | |
Re: What Narue said is pretty much on the money, but the way the answers are given may be a bit confusing. Allow me to re-post an old piece I wrote on DevShed many moons ago: [url]http://forums.devshed.com/showpost.php?p=2001351&postcount=14[/url] | |
![]() | Re: Actually, there is a project to write a 32-bit version of FreeDOS, called (naturally enough) [url=http://freedos-32.sourceforge.net/]FreeDOS-32[/url]. I don't know if it is an active project or not, but you might consider contributing to it if you are genuinely interested in it. However, as Ancient Dragon said, DOS is pretty much … ![]() |
Re: actually, I suspect that what he's really looking for with the first question is not to be able to add members to the struct, but to be able to dynamically allocate new structs which would be associated with some other data structure, such as a linked list or a tree. | |
Re: AFAIK, there is no portable way to get the size of a file, because the standard library doesn't really have an abstraction for files per se (despite the standard FILE handle). Rather, it is all based on streams, which in principle can be of indefinite length. Files (as opposed to … | |
I have an event handler that is failing with an SqlException [icode]'{"Procedure or function 'SetClientEmail' expects parameter '@OldEmailAddress', which was not supplied."}'[/icode] However, the code for the SqlParameter '@OldEmailAddress' is no different than that for the other SqlParameters I am using, both for this command and for others I have … | |
Re: I'm not sure why you're having trouble passing strings, but it certainly ought to work. For example: [code]def printString(my_str): print(my_str)[/code] I suspect where you're having trouble is in passing values to methods, but that too should be straightforward; you simply put the arguments after the self argument. [code]class Player(): def … | |
I [url=http://www.daniweb.com/software-development/python/threads/364777]recently discussed[/url] some problems I had had in getting PyODBC working with Django and Django-pyodbc, but at the time it was decided to switch to an ASP.NET solution instead. For various reasons, we are trying once again to set up Django and PyODBC, and while we've had some success, … | |
Re: Is there any specific application for this, or are you simply trying to understand PRNGs better? Different applications can have very different requirements, above and beyond randomness, such as needing the result to be random within a given range (simply using a modulo isn't a very good solution, as it … | |
Re: I recently explained the Python equivalent of the pointer-to-member operator [url=http://www.daniweb.com/software-development/python/threads/302070/1563932#post1563932]here[/url], and you may want to read through that; however, I suspect that what you want is a reference to the function itself, rather than to call the member function. In Python, the simple solution is to use... the name … | |
Re: Would you mind telling us what the different strings represent? (My initial impression was that they were the names of genes and gene complexes, but I'm not certain.) Having some idea of what the data represents might give us some new ideas as to how to manipulate it more effectively. | |
Re: Could you explain a little more about what you're trying to do? There may be some other ways to solve this problem. If what you need is the input string, and not the error message, then this should work: [code] inString = input() try: x=int(inString) except ValueError as var: print(inString)[/code] | |
Re: [b]EDIT[/b]: Never mind, you seem to have come up with more or less the same solution on your own while I was working on this. My version's a little more efficient in terms of space, but yours is easier to understand. You might want to look at my version anyway, … | |
Re: The single vertical bar is for the [url=http://docs.python.org/release/2.5.2/ref/bitwise.html]bitwise OR operator[/url]. What the code is doing is taking the [icode]S_IFDIR[/icode] flag (which indicates if a given file handle is actually for a directory), and overlaying the bitfield for the desired file permissions, which results in the overall file mode value. See … |
The End.