1,359 Posted Topics
Re: Let's see if you can determine the problems with these two lines: void copy() and return (x +1); then figure out what it implies for copy() (Bonus points if you can see the syntax error in that last line.) | |
![]() | Re: Has the instructor covered dynamic memory allocation (`new` and `delete`) yet? |
Re: If output alone were your goal, I would say to use an `ostream` for the variable class and `ofstream` for the output file. However, you are then using the file for input, which does indeed lead to the problem you describe. Wait, what is the goal, here? Why would you … | |
Re: Woooee's advice is spot on, as far as it goes. However, if you are trying to repeat something without knowing how many times to repeat it, what you would want is a `while:` loop. pagechoice = '1' while pagechoice != '0': pagechoice = input("Please choose one:") #Now it will determine … | |
Re: I would actually recommend [Gnome Sort](http://en.wikipedia.org/wiki/Gnome_sort), as it is a little smaller marginally faster than Bubble Sort, though it is a little harder to understand. The main reason bubble sort is such a topic of fascination for computer scientists is that it appears to be the 'naive' algorithm for sorting, … | |
Re: in the line in question: sum[M][3] = inputarray[M][3] + inputarray2[M][3]; You are treating `inputarray()` and `inputarray2()` as arrays, rather than calling them as functions. The correct syntax would be: sum[M][3] = inputarray(M, 3) + inputarray2(M, 3); BTW, I strongly recommend you get into the practice of indenting your code suitably. … | |
Re: I think you'll find a purely functional sub-set of [Scheme](http://en.wikipedia.org/wiki/Scheme_%28programming_language%29) sufficiently simple for you needs. It is famously easy to implement in a short program, and requires relatively few resources (mainly, some form of garbage collection or reference counting - the latter of which PHP already supports IIRC). Several online … | |
Re: Because each digit in an octal value is equal to three bits of binary, and each hex digit is equal to four bits. The higher the base, the more compact the representation. This is related to why decimal doesn't suit many purposes in computer mathematics - base 10 doesn't line … | |
Re: It would help a lot if you told us what was going wrong; while we can surmise a lot from the code, to be as accurate as possible, we would need to know the exact error messages you are getting. That having been said, I can see three major problems, … | |
Re: What you need to see here is that the 'decimal equivalent' is actually a string of characters, for which there may be (in the case of a 64-bit two's-complement integer representation) 19 digits and a sign to represent. Depending on the character encoding, this may mean as much as 80 … | |
Re: Unfortunately, you still aren't indenting your code, making it virtually impossible to read the program. Allow me to (once again) run your code through [Astyle](http://astyle.sourceforge.net/) and format it sensibly: #include<iostream.h> #include<conio.h> #include<stdio.h> char value; char t, u, v; char answer; void Binary2Decimal() { gotoxy(1,13); printf("[BINARY TO DECIMAL CONVERSION]"); long b2,f2=1,d2=0; … | |
Re: A commendable ambition, I suppose, though I would personally recommend aiming a little lower to start with - C++ is a tremendously complicated language and IMAO not well suited for beginners. Learning a simpler programming language such as Python would be advisable as a start. Indeed, you would probably go … | |
Re: OK, so what you actually need is a *[lexical analyzer](http://en.wikipedia.org/wiki/Lexical_analysis)*, also called a *tokenizer* from it's main mode of operation, which is to break a stream of characters into tokens. There are several discussions of this topic on DaniWeb, if you do a search on 'tokenizer'. You might want to … | |
Re: A base class (or parent class, or superclass) is a class which one or more child classes inherits from; a child class (or sub-class) is one which inherits from a base class. Depending on the language, you may have some programmer-defined classes which have no base classes, or (more often) … | |
Re: The primary thing that leaps out at me is that you dropped the left brace on line 5. | |
Re: It shouldn't be necessary to do so, but it might help put the class in context. Posting the error log would probably be more helpful, in this case, especially since I was able to compile the code (with the open brace restored and the c'tor name corrected) with no trouble … | |
Re: If you look down the C++ forum page to the [previous thread](http://www.daniweb.com/software-development/cpp/threads/474555/corrections-turbo-c-conversion), you'll see that I gave a detailed answer already. Would you do us all a favor and **not** create a new thread each time you log in? It is much easier for everyone if you continue the existing … | |
Re: As I explained in my previous response, what you are trying to write is a lexical analyzer. I gave links to some helpful posts and resources in that post that you should have gone over by now. No one here is going to write this program for you. We can … | |
Re: > My prof said that she will not accept my program because she said that cout,cin & etc... are not allowed use only the older style.. Hold on for a moment. Is this a course in C++, or in C? Most C++ compilers (including Turbo C++) will also compile C … | |
Re: While it is unfortunate that it took so long for one of us to get back to you, you have to understand that this can and often does happen on these fora; we are doing this on a volunteer basis, and there isn't always someone able or willing to answer … | |
Re: Well, the first part (display user instructions) seems straightforward; simply write a function that displays the instruction message. While you can probably hard-code the instructions and get credit for it, I would recommend storing them in a data file which the program can read at initialization. BTW, part four is … | |
Re: There are actually a number of them out there, at least two of which are actually called 'NASM-IDE'. The more familiar one is probably [url=http://www.nasmide.co.nr/]this one[/url], though it has it's problems - many people dislike it for it's flakiness. Another popular choice is [url=http://www.oby.ro/rad_asm/]RadASM[/url], which is said to have excellent … | |
Re: The problem seems to be the simplest of all: in the `if()` statement, you compare `sex` to `"F"` (capital F) instead of `"f"` (lowercase f). This can be solved simply by changing the character being compared, though I would actually recommend a more general solution, by forcing the characters to … | |
Re: OK, as an aside, what is with these '213xxxxx' usernames? Is this one person creating multiple accounts, or are these student IDs all from a single school, or what? | |
Re: In addition to what Deceiptikon and sepp2k said, I would add that it yu've declared the function as returning an `int` value, but at no point to you actually return one. There is actually a much simpler way to do this, one which takes only the starting value as an … | |
Re: In essence, a [lambda expression](http://en.wikipedia.org/wiki/Lambda_%28programming%29) is an anonymous function, which can be used in a context where a regular named function could be used, but where the function in question exists for a single purpose and thus should not be given a name (to avoid using up the namespace). They … | |
Re: We can start by explaining how to post code in this forum correctly, and while we're at it, how to format Java code according to the usual conventions. The forum software does not, by default, retain indentation; in order to post code samples, you need to indent the code by … | |
Re: In C/C++, command-line arguments (AKA shell arguments) are passed through optional parameters to the `main()` function. These parameters, by convention named `argc` and `argv`, are an integer count of the arguments passed to it, and a pointer to an array of `char` arrays, which hold the string values of the … | |
Re: First off, we don't do other people's homework for them. Second, we *don't* do other people's homework for them. And third, ***we don't do other people's homework for them***. Sensing a pattern here yet? No one here will simply hand you a solution on a silver platter. If you show … | |
Re: Could you please tell us what system or emulator you are using? There are small but sometimes important differences in the way different emulators (e.g., SPIM, MARS) work, especially in terms of the assembly directives they accept, and it may be relevant. For now, I'll assume you are using SPIM, … | |
Re: What, if anything, do you have already? I would recommend starting with a simple function that takes a Celsius value and returns the Fahrenheit equivalent. If you don't know how to write a function, let us know and we'll explain it for you. | |
Re: It would be impossible for us to tell you how to describe a lesson we haven't seen ourselves. I can make a few guesses on things, but I can't be certain they are correct. * I think you have the relationship between Raspberry Ï€ and the Python language interpreter reversed. … | |
Re: As sheikh.islampollob said, the language that you use to implement the project is less relevant to the solution than the design of the program is. One thing I will tell you right now is that the project as described will take more than a month to finish correctly; indeed, if … | |
Re: Hold on for a moment, here. Is this supposed to be a C++ program, or a C program? While most C code is also valid C++, as a rule in C++ you want to avoid using certain C idioms and functions, with `malloc()`, `free()` and the standard C I/O functions … | |
Re: If you are of a mathematical bent, you might try the exercises on [Project Euler](https://projecteuler.net/). | |
Re: The two errors you mention come from the same source: line 2. The directive you want is `use namespace std;`; note the semi-colon, and the difference is the word `use` versus `using`, as well as the need to actually give the namespace you want to make visible (in this case, … | |
Re: I know you have a working program as of now, but you'll still want to try and understand the difference between a function prototype and a function call, and between the formal parameters and actual arguments. First for prototypes. These are, basically, declarations describing how the function's *signature*, which is … | |
Re: We would need to see the code, or at least the parts that are experiencing difficulties. We'd also need to know the errors you are getting. Finally, it would help if you could tell us what the porgram is for, and how it is meant to work. Are you certain … | |
Re: Actually, it does say Java, in the second assignment description. I suspect, however, that it was an error - my guess is, they use the same basic assigment in both the C++ and Java courses, and the instructor made a mistake when editing the assignment. | |
Re: As Moschops says, the Turbo C++ compiler dates from 1989, and was for a older operating system that is no longer supported by Windows' backwards compatibility. If you are using a version of Windows newer than XP (that is, Vista, 7, or 8), then there is no way to run … | |
Re: First off, we don't do other people's homework for them. Second, we *don't* do other people's homework for them. And third, ***we don't do other people's homework for them***. Sensing a pattern here yet? No one here will simply hand you a solution on a silver platter. If you show … | |
Re: You say that the code compiles without problem, but I can see an extraneous open brace at the top of the code which would be a showstopper. This may simply be an artifact of copying the code to the forum, however. I recommend you indent your code effectively, according to … | |
Re: What is happening here is that you are actually calling the `input()` operation separately each time you are testing for it, which means that if the value of the first entry is not `'1'` (and note that it is the string `'1'`, not the numeric literal `1`), then the value … | |
Re: Then you should have asked the question in a new thread, rather than raising a long dead one back up. As for the answer to your question, the original C++ compiler was written in C, and most C++ compilers today are written in either C or C++. I gather, however, … | |
Re: Oh, and for the future, please do not use ALL CAPS in your postings like that. It is universally considered quite rude, as it is seen as the equivalent of shouting at the top of your lungs. Proper punctuation, grammar and netiquette are quite important in fora like these, *especially* … | |
Re: We cannot simply give you code; that would be cheating. However, I can offer you the algorithm which you can use; I'm a bit short on time right now, but I should be able to get back to you in a couple of hours. | |
Re: First off, could you give more detail as to what you need? As I understand it, Kirchhoff's First Law is an equation regarding electrical flow across circuit intersections; Wikipedia gives the informal form of it as: > At any node (junction) in an electrical circuit, the sum of currents flowing … | |
Re: Please do not hijack existing threads with unrelated questions like this; in the future, start your own thread. In any case, the question is too broad, and has too many unknowns (regarding your state of knowledge, the context in which the question comes up, etc.) to be easily answered; it … | |
Re: Could you post your exact code here, please? I have a suspicion why it isn't working, but it is hard to say without seeing what is actually running. | |
The End.