1,362 Posted Topics
Re: After all the furor of workers suing over environmental health issues, most of Area 51's work has been moved to a new super secret site in Utah. But you didn't hear that from me. | |
Re: rollsize, rolls, results all need some data type - what are they? Also, you cannot use the variable rollsize to set the size of the array - it must be a constant value (well, some compilers are letting you do this now, but it's not in C++ standard yet.) In … | |
Re: Does nothing at all get written to any of the files? As written, you will not add to files, you will overwrite any existing content. You need to open the files with ios::app (append mode) if you want to add to the files, as in keeping a log. | |
Re: You could put a loop in main( ) that prints every fibonacci number up to the input value from the user. Note that the results you show in your sample are not the Fibonacci series 1 1 2 3 5 8 13.... but your code does give correct results. | |
Re: It would help to see your onedie class as well. Does it have some method such as rolldie? How have you tried to write these two functions? | |
Re: If you look back in this forum, the prime number problem has been discussed many, many times in just the past week. What do you mean by "it got TLE"? | |
Re: I found 11 in about 5 minutes. To find all 50 will be quite a feat. | |
Re: As I'd said privately, you don't want to change the EOF char in your ciphertext - that will corrupt the data. In order to read in the file, without the EOF character halting the read, do so in a binary fashion. Grab 16 bytes, then place them in your 4x4 … | |
Re: In your factorial function, you've got the right idea of stopping at a base case. But, if you check the definition of factorial, 0! should return 1. As you have it now, n! will always end up as 0. [code] if( number == 0 || number == 1 ) return … | |
Re: I don't have a conclusive answer for you, but I don't think the effect you see is related to the dot operator, per se. What you're seeing is the same order of operations as with simple types as well. The insertion operator ( << ) works right to left - … | |
Re: The only output I see, other than the prompts for data, is [icode] cout<<reversing;[/icode] which is displaying the "address" of the function. Do you mean to call the conversion function first? Do you have a clear picture of the flow of data? what role does the ans[] array play? | |
Re: Factorial function is really pretty easy - often used in any tutorial about recursion, although a method using a loop is more efficient. Keep in mind that factorial grows very fast - depending on how many iterations your calculation for sine goes, unsigned int may not be a suitable data … | |
Re: If you're expecting someone to fix your typos and simple mistakes, you may be waiting for a while. Read the error messages, pay attention to the lines they point you to. A couple? Well, at first maybe. Fix the errors, find your other errors, then find some more. | |
Re: I believe you have to install the VS 2005 SP1, and then there's an additional Vista update. | |
Re: Compaq has a [URL="http://forums1.itrc.hp.com/service/forums/bizsupport/categoryhome.do?categoryId=411"]user forum[/URL] where you might get detailed help | |
Re: [URL="http://insar.stanford.edu/~lharcke/programming/IAS_Final_Report.pdf"]THIS [/URL]seems to be the source document on the IAS, I think. Seems a rather arcane kind of an assignment. Ezzeral's comments were quite correct in this forum. If you want help, the normal way is to show your work, show you've made effort to solve the problem, then others … | |
Re: two things you need to do to fix what you've got: Initialize the bins array - you start your counting with random junk in the array [icode] int bins[20] = { 0 }; [/icode] Initialize min and max to the first element of the diff array. You say in your … | |
Re: It would help to see the definition of your Set class. From your usage, I'm guessing that a Set object has a data member set[] ? If so, then your assignment statement should be [icode]tempSet.set[i] = set[i];[/icode] | |
Re: What you've been given is the function prototype, which describes to the compiler the "signature" of the function. When you write your implementation (definition) of it, you must supply parameter names for the function to use. So in your program, it might look like: [code=c++] #include <iostream> using namespace std; … | |
Re: [QUOTE=dougy83;559767]You will likely find searching the array will be faster if you declare it as a MyArray[2][1000], this way the compiler/cache/whatever is more likely to hit. <snip>[/QUOTE] You've just made the cache problem worse. Now the two paired items are 1000 elements apart in memory. Are you an old FORTRAN … | |
Re: One aspect not looked at in comparing the two functions (using n/2 or sqrt(n) as the loop limit) is the overhead of calling sqrt repeatedly, even if fewer times than the n/2 method loops. To get the most out of that method, compute and store the sqrt(n) value before the … | |
Re: [QUOTE=cscgal;560554]You cannot be talking about anything real if you started a thread about your computer really being alive.[/QUOTE] Are you sure they are not? Try to find an old sci-fi short story, "Inanimate Objection" by H. Chandler Elliott. | |
Re: [QUOTE=henpecked1;561429]<snip> Something isn't letting it continue to "do" . It will ask for the y or n, but then it does nothing. I can keep entering stuff from the keyboard, but it doesn't ask me for last name again, nor does it exit[/QUOTE] The while loop for the yes/no input … | |
Re: It's the method by which you give operators a new definition, particularly within classes. Most helpful with appropriate math, comparisons, and the input/output operators. Google is your friend. Here's one fairly [URL="http://www.learning-computer-programming.blogspot.com/2007/08/introduction-to-operator-overloading-in.html"]understandable explanation[/URL], with example, that comes up early in the 310,000 hits. | |
Re: [quote]Does anyone have any tips on how to write my code.[/quote] Start with pencil and paper. Write down what you know, write down what you need to do to what you know. Sketch out your program's main aspects. Input - Processing - Output. Take it in manageable bites. Don't think … | |
Re: Also remove the semicolor ( ; ) at the end of the if statement. | |
Re: The problem occurs at line 13. "result" has no type, as no "out_type" is passed to the templated function. Frankly, what's up with all the casting in lines 155 & 156? What if you replaced your lines 150-176 with: [code] cout << "Enter name of file to save to\n[address_book.txt]->"; getline(cin, … | |
Re: Use the search box in the upper right corner - you'll find this topic has been discussed several times. What type music file do you want to use? Vegaseat wrote a good piece of code for playing MIDI files, and you'll find references to using playsound( ) in Windows for … | |
| |
Re: A little more information, please. What are you trying to output? Do you have particular formatting requirements (spaces, decimal precision, etc.)? Please show the code you have so far, and tell us what you are having trouble with, in a more specific manner. Then we will be able to give … | |
Re: [QUOTE=vijayan121;557515]<snip> note: *do not* do this: [icode]char( 'A' + ri )[/icode][/QUOTE] I'm curious why you say this? | |
Re: [QUOTE]- Too many people are basing their demands for action on the dire predictions of what "might" happen if global warming in fact occurs, instead of on whether or not global warming has been shown to be occurring. [/QUOTE] And on the assumption that human activity has played any significant … | |
Re: [QUOTE=lAmoebal;553912] <snip> sum += sum + i; Make sure you start sum at 0 before the loop. [/QUOTE] You really meant either: [code] sum += i; //or sum = sum + i; [/code] right? The uppercase letters problem - use a loop with a character as the loop variable, starting … | |
Re: Assuming that prog3 is of type string, your open statement should be: [code] rptout.open(prog3.c_str(), ios::app); [/code] This give the equivalent of a C-style (character array based) string which the open command needs. | |
Re: How are you connecting wirelessly? Public access, home router, ....? Have you tried connecting at another location? | |
Re: My favorite way to mess with folks is do a screen capture of their desktop, save it as an image, then display the image fullscreen (irfanview works well) They spend minutes clicking on their shortcuts, the start button, taskbar.... | |
Re: When you may not know the actual range of data to be used, better to start min and max as the first data item's value. Then you always have a valid comparison. [code] //updating AD's code int min = temp[0], mintempnum = 0; int max = temp[0], maxtempnum = 0; … | |
Re: ...a Christmas tree that tells you when people are lying, is fully recycleable and is bigger on the inside than the outside. Kind of like the TARDIS? | |
Re: Q3 is a kind of fun one. Are you being asked to identify/describe what it is, what it's doing? Or are you to write the code that implements it? Hint - lots of loops. How would you make it alternately add then subtract? | |
Re: You can save writing, and unnecessary testing in your check charge section: [code=c++] if (checkw < 20) ppch = .10 else if (checkw == 20 || checkw <= 39) ppch = .08 else if (checkw == 40 || checkw <= 59) ppch = .06 else if (checkw > 60) ppch … | |
Re: [code] int write(int id) { ofstream myfile; myfile.open ("account/"id"/example.txt"); //this is where the error pops up myfile << "this is what I want written"; myfile.close(); } [/code] Yep, there's definitely an error there. The double quote at the beginning of [b]id[/b] closes off the string for the open command, then … | |
Re: [QUOTE=Ancient Dragon;544288]Dam -- I meant to vote for 100+ but hit the wrong button :)[/QUOTE] Is it legal to vote for yourself? | |
Re: [QUOTE=zhelih;541633]You thing that for (x = 0; x < 2000000000; x++) will work quickly??? Mad boy. If you start this loop without any operations it will be VERY long....[/QUOTE] Please define "VERY long" Pentium D 3.2GHz (one core tied up with other processing) took 8 seconds to run the loop … | |
Re: In fact, fstream parameters [b]must[/b] be passed by reference by the current standards. Pass by value should result in a compiler error. | |
A US Federal judge in California has taken drastic steps in "removing Wikileaks.org from the DNS system". It's complicated - a Swiss bank wants documents about its alleged money laundering in the Cayman Islands suppressed on a site registered to a person in Kenya, with the domain registrar in California, … | |
Re: I think examining the contents of a computer or other storage device by customs, without any reasonable basis or suspicion, is wrong. Do they have any right or reason to rifle through your dayplanner, look at the contents of your wallet? No. Data stored on the computer is no different. … | |
Re: You need to use doubled equal sign for the equality comparison. As in: [code] if ((first==paper) && (second==rock)) [/code] What you have assigns paper to first (and evaluates as TRUE) and assigns rock as second (which also evaluates as TRUE), so your first test always runs. | |
Re: Here's what I see should be occurring: The outer loop runs 49 iterations. In each it: puts the text "Display this" to the text of CurrentSymbol (which I don't know what happens there) the file DGD.txt will be opened, the while loop then reads it line by line to the … | |
Re: Good start. You got the reference arguments right. First, function needs a return type in its definition, even if it returns nothing. Place the keyword "void" in front of the function name. Your input statement is wrong on two counts. You have the arrows pointing wrong way (think of them … |
The End.