1,362 Posted Topics

Member Avatar for Google Spider

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.

Member Avatar for sneekula
0
218
Member Avatar for henpecked1

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 …

Member Avatar for vmanes
0
310
Member Avatar for knight fyre

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.

Member Avatar for vmanes
0
141
Member Avatar for knewc

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.

Member Avatar for BlackJavaBean
0
107
Member Avatar for henpecked1

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?

Member Avatar for vmanes
0
288
Member Avatar for ulyssesmn

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"?

Member Avatar for vmanes
0
85
Member Avatar for The Dude
Member Avatar for Nick Evan
0
99
Member Avatar for kartouss

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 …

Member Avatar for kartouss
0
550
Member Avatar for lostandconfuzed

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 …

Member Avatar for vmanes
0
114
Member Avatar for snorri

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 - …

Member Avatar for snorri
0
96
Member Avatar for Crazycfk

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?

Member Avatar for skatamatic
0
127
Member Avatar for tlox

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 …

Member Avatar for vmanes
0
347
Member Avatar for DJPlayer

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.

Member Avatar for vmanes
0
85
Member Avatar for bungek84
Member Avatar for markc63

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

Member Avatar for markc63
0
80
Member Avatar for diggles05

[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 …

Member Avatar for diggles05
0
879
Member Avatar for Ripture

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 …

Member Avatar for vmanes
0
126
Member Avatar for Serling1

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]

Member Avatar for Necrolis
0
454
Member Avatar for paradox814

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; …

Member Avatar for paradox814
0
129
Member Avatar for prayami

[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 …

Member Avatar for prayami
0
178
Member Avatar for Moporho

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 …

Member Avatar for Moporho
0
5K
Member Avatar for kv79

[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.

Member Avatar for majestic0110
0
115
Member Avatar for henpecked1

[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 …

Member Avatar for henpecked1
0
193
Member Avatar for rohoni

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.

Member Avatar for amitahlawat20
0
106
Member Avatar for badboydrix

[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 …

Member Avatar for vmanes
0
65
Member Avatar for Cosa
Member Avatar for Cosa
0
285
Member Avatar for c++noobie

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, …

Member Avatar for c++noobie
0
2K
Member Avatar for hjjayakrishnan

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 …

Member Avatar for vmanes
0
104
Member Avatar for MidiMagic
Member Avatar for nurulshidanoni

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 …

Member Avatar for WaltP
0
67
Member Avatar for artisabang

[QUOTE=vijayan121;557515]<snip> note: *do not* do this: [icode]char( 'A' + ri )[/icode][/QUOTE] I'm curious why you say this?

Member Avatar for WaltP
0
10K
Member Avatar for sneekula

[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 …

Member Avatar for reddawg
0
1K
Member Avatar for Exo1337

[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 …

Member Avatar for carnage
0
211
Member Avatar for ramrod

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.

Member Avatar for vmanes
0
101
Member Avatar for lawyerandagun

How are you connecting wirelessly? Public access, home router, ....? Have you tried connecting at another location?

Member Avatar for HoustonIT
0
133
Member Avatar for Michael_Knight

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....

Member Avatar for MidiMagic
1
142
Member Avatar for sneekula
Member Avatar for curt1203

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; …

Member Avatar for curt1203
0
490
Member Avatar for The Dude

...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?

Member Avatar for maui_mallard
0
245
Member Avatar for angellove40

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?

Member Avatar for vmanes
-1
125
Member Avatar for micah1983

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 …

Member Avatar for carnage
0
118
Member Avatar for thecraig

[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 …

Member Avatar for thecraig
0
102
Member Avatar for Lardmeister

[QUOTE=Ancient Dragon;544288]Dam -- I meant to vote for 100+ but hit the wrong button :)[/QUOTE] Is it legal to vote for yourself?

Member Avatar for vegaseat
0
117
Member Avatar for TheBeast32

[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 …

Member Avatar for TheBeast32
0
321
Member Avatar for Squeeker

In fact, fstream parameters [b]must[/b] be passed by reference by the current standards. Pass by value should result in a compiler error.

Member Avatar for vmanes
0
141
Member Avatar for vmanes

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, …

Member Avatar for Lardmeister
0
293
Member Avatar for zandiago

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. …

Member Avatar for jbennet
0
640
Member Avatar for Spencicle

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.

Member Avatar for vmanes
0
95
Member Avatar for Jennifer84

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 …

Member Avatar for Jennifer84
0
111
Member Avatar for Jboy05

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 …

Member Avatar for Jboy05
0
105

The End.