Forum: Geeks' Lounge 2 Hours Ago |
| Replies: 5 Views: 58 Why would you start a thread in the Geek's Lounge and then say this? I mean what's the point of starting a thread if you don't want other peoples' opinions? |
Forum: Java 8 Hours Ago |
| Replies: 3 Views: 64 Get the count
Calculate the sum
From the count and the sum, calculate the average.
From the average, get each deviation (error).
Square each deviation (squared error).
Add up the squares... |
Forum: Java 10 Hours Ago |
| Replies: 2 Views: 81 Code tags and formatting please. The code is unreadable now as it is.
// code here
Before you can work on the borrowing function, you need to set up your ArrayLists correctly. |
Forum: C++ 20 Hours Ago |
| Replies: 3 Views: 104 Yeah, I don't see the word "extends" in your Java code, so I'm doubtful of the inheritance. firstPerson is right regarding pointers and pass-by-value. I'd have to see the overall set-up, but you're... |
Forum: C++ 20 Hours Ago |
| Replies: 1 Views: 69 Can't test it since you haven't provided the input file. My best advice for now is that you need to make sure you're reading in the data in the first place. It looks like the first thing read in on... |
Forum: C++ 1 Day Ago |
| Replies: 8 Views: 132 Yes, you are correct. Thanks for pointing that out. I was thinking of the time(time_t*) (http://www.cplusplus.com/reference/clibrary/ctime/time/) function. I was pretty sure it would not be a... |
Forum: C++ 1 Day Ago |
| Replies: 1 Views: 107 Not very difficult. It's far harder to pull off the trick as the person typing in the question.
But you're in the wrong forum. It's definitely not C++. Go to "View Page Source" and you'll see... |
Forum: C++ 1 Day Ago |
| Replies: 8 Views: 132 Without seeing the function calls and the class and the exact assumptions regarding what you can assume as far as data, plus whatever else may be going on with the stream, I'm not 100% sure what the... |
Forum: C++ 2 Days Ago |
| Replies: 2 Views: 79 Close on the code tags. Note the / (slash) on the ending tag:
// code here
You need to find "s" OR find "ing", not both. If you have "standing", you want to end up with "stand",... |
Forum: C++ 2 Days Ago |
| Replies: 8 Views: 132 If you read it in as a c-style string, you can use getline and specify 6 characters (5 + 1) maximum. Or use get () five times.
http://www.cplusplus.com/reference/iostream/istream/getline/
... |
Forum: C++ 2 Days Ago |
| Replies: 5 Views: 143 Open the file.
Read all or part of the file into variable(s).
Display the variable(s).
Repeat steps 2 and 3 till end of file. |
Forum: C++ 3 Days Ago |
| Replies: 6 Views: 137 You're going to have to clarify. Do you have some executable program, originally written in C++, that you want to run at, say 2 p.m.? All sorts of languages can be used to cause this to happen, not... |
Forum: DaniWeb Community Feedback 3 Days Ago |
| Replies: 5 Views: 263 That's the main problem, I think. I'm not crazy about the syntax-defaulting the way it is now, but since I know about it, I can get around it when I want to. However, the code syntax defaulting has... |
Forum: C++ 3 Days Ago |
| Replies: 8 Views: 157 Runs fine for me using 1235 and 3459 as input. They're sum buddies and are reported as such. What input is not working for you? |
Forum: C++ 4 Days Ago |
| Replies: 8 Views: 141 The devil is in the details and you have dots there so it's unclear whether there is some sort of pattern. You have this line in a previous post:
Replacing "A" with "test",
You say id has... |
Forum: C++ 4 Days Ago |
| Replies: 8 Views: 141 I'll reiterate what I said in my last post. The code is not going to compile with terms like A[0].b in it and it has nothing to do with whether you use if-statements or switch statements. A is a... |
Forum: C++ 4 Days Ago |
| Replies: 13 Views: 345 If you can get it to work without a function, it's a matter of converting that code so that it's inside of a function. Post the code that works where it's all in main. |
Forum: C++ 4 Days Ago |
| Replies: 17 Views: 266 That's what "return" does. It takes you back to main, to the place right after where you called the medic function, which puts you back in the main function. So if the person enters 2 in the medic... |
Forum: C++ 4 Days Ago |
| Replies: 17 Views: 266 Do NOT call the main() function. If you want to repeat, your program should look something like this (starting at line 61):
do
{
// display user's options
// ask user to input option.
... |
Forum: C++ 4 Days Ago |
| Replies: 3 Views: 103 http://www.cplusplus.com/reference/clibrary/cstdlib/system/
"system" is in cstdlib, not iostream.
But you're right. That's not the problem. You need to proofread your posts. The error isn't... |
Forum: C++ 4 Days Ago |
| Replies: 17 Views: 266 Lines 20, 88. Arrays already are passed by reference. Get rid of the ampersand:
void medic(int & money, int & potionsize[5]);
Delete the ampersand in red above on line 20 and on line 88.... |
Forum: C++ 4 Days Ago |
| Replies: 3 Views: 103 If you use "system", you should import cstdlib, because that's the library "system" is from.
But don't use system ("PAUSE") anyway. Use cin.get() once or twice instead.
... |
Forum: C++ 4 Days Ago |
| Replies: 2 Views: 80 I think you need to give an example. What's idnum? How does one determine yearbirth from idnum? idnum is an int. There's no "int" class, so the dot operator won't work.
idnum.subint (0,2);
... |
Forum: C++ 5 Days Ago |
| Replies: 8 Views: 141 You should replace A with test everywhere inside your function body. A is a type. test is the variable itself. test is an array, not A. You cannot dereference A with the [] operator because... |
Forum: C++ 5 Days Ago |
| Replies: 4 Views: 136 // outline
// #include statements here
// #define statements here
// global variables here
// function declarations here
int main (int argc, char* argv[])
{ |
Forum: C++ 5 Days Ago |
| Replies: 6 Views: 186 Looks good to me. Try it out. Does it work? |
Forum: C++ 5 Days Ago |
| Replies: 1 Views: 104 I'm not sure than sum[] array is initialized except for index 0. also, there is no call to srand, so I imagine you'd get the same results every time. You need to initialize the sum[] array before... |
Forum: C++ 5 Days Ago |
| Replies: 6 Views: 186 #include <iostream>
using namespace std;
int main()
{
int TESTS = 0;
int testScore[TESTS];
int testNum = 0;
int a;
double total = 0; |
Forum: C++ 7 Days Ago |
| Replies: 3 Views: 159 a, b, and c. What's the difference between "set" and "store and set"? I assume you want the normal "set" and "get" function for each of the three private variables. So at minimum, three private... |
Forum: Java 7 Days Ago |
| Replies: 2 Views: 172 One, code tags. Use them.
// paste code goes here
Two, Where's the error and what is it? Point out a line number. |
Forum: C++ 7 Days Ago |
| Replies: 4 Views: 148 |
Forum: C++ 7 Days Ago |
| Replies: 4 Views: 148 Common problem when mixing >> and getline. You need to flush the input stream before the getline command to get rid of the pesky '\n' left by the >> operator. See the ignore page from cin, and see... |
Forum: C++ 7 Days Ago |
| Replies: 13 Views: 345 You're simply merging two files that are ALREADY in order into one output file. Hence only very minimal storage is required (one value from each input file), so vectors are overkill. Have two... |
Forum: C++ 8 Days Ago |
| Replies: 10 Views: 368 That's what I don't understand. Seeding seems necessary to me here. Isn't it necessary to seed the random number generator if you want good results? |
Forum: C++ 8 Days Ago |
| Replies: 10 Views: 368 I'm intrigued. Why would you consider not seeding the RNG here? |
Forum: C++ 8 Days Ago |
| Replies: 4 Views: 182 These lines are not being skipped. The Fahrenheit values are 32 larger than the Celsius values, which suggests that at least part of the equation is working. Comment the lines out and pick a... |
Forum: Java 9 Days Ago |
| Replies: 6 Views: 199 Code tags are simply this.
// paste code here
You had it close on your first post. |
Forum: Java 9 Days Ago |
| Replies: 6 Views: 199 Here's your code, formatted and in code tags:
//This is an inventory program that stores
//and lists the inventory of Coaxial Connector-fittings
//Author:
//Class: IT215
//Date: October 17,... |
Forum: Geeks' Lounge 9 Days Ago |
| Replies: 15 Views: 587 Five down votes on this one? Seems a bit extreme. As Best Jew points out, probably not the best forum to post on with this question, but it's still a reasonable question. But not knowing you and... |
Forum: C++ 10 Days Ago |
| Replies: 5 Views: 213 This is what I've been harping on since the major change-over at Daniweb. Java code is now flagged as C++ code instead of plain-old code if you don't specify Java-specific code tags. It... |