Search:
Type: Posts; User: jsg
Search:
Search took 0.02 seconds.
-
December 3rd, 2010, 09:50 PM
main returns an int not a void.
You should do something like:
int main(int argc, char** argv) {
// Your code here
return EXIT_SUCCESS;
}
-
December 3rd, 2010, 06:26 PM
That's a really sweet answer.
-
December 3rd, 2010, 06:19 PM
Egads man, you're killing me!
#include <iostream>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <string>
// This is a dichotomous key written in C++ since I didn't want...
-
December 3rd, 2010, 06:00 PM
Forget what I said, that crazy indentation made it too difficult to follow the logic. Make sure all your ifs are actually testing the right conditions, and although I still see the indentation as...
-
December 3rd, 2010, 05:39 PM
Your indentation is messed up, but what you need to do is make sure you are using || (logical or) and && (logical and) where appropriate.
-
December 3rd, 2010, 05:29 PM
You should probably change those char[]s to strings:
int what, size;
string name, piece, research, where, amount, other;
And where you have:
Use:
-
November 29th, 2010, 11:36 PM
While I don't disagree with you, the OP presented his problem with the quarter being the most significant coin.
It sounds an awful lot like a homework question, and I bet the problem doesn't...
-
November 29th, 2010, 11:15 PM
This sounds similar to what my friend needed to create a dynamic menu that can change during run-time.
He used what he called pure virtual functions.
Unfortunately, I'm still just learning, so...
-
November 29th, 2010, 09:24 PM
Thank-you for the explanation, and now I see why it fails to produce the expected results. Changing the values to whole numbers fixes the problem and now it works fine.
a = ta*100;
q = gc(a,...
-
November 29th, 2010, 08:41 PM
A couple of days ago someone posted a question about a change-maker program. Coding a solution to the problem seemed like a fun little exercise to try.
Here is the code:
using namespace std;...
-
November 28th, 2010, 01:33 AM
How many quarters total?
1.37 / 0.25 = 5.48
5.48 throw away the remainder = 5
Subtract total quarter value
1.37 - (0.25 * 5) = 0.12
This leaves 12 cents
How many dimes?
0.12 / 0.1 = 1.2...
-
November 27th, 2010, 10:52 PM
I made a little program to try to understand
int main() {
int a = 10;
a(20); // produces same error
}
So I guess the big clue was the word initialization. Once a variable...
-
November 27th, 2010, 10:40 PM
I apologize, I'm still trying to learn the correct terms for things. I still don't understand why it works in some places, but not others. My book doesn't seem to explain why, it just says it can be...
-
November 27th, 2010, 10:33 PM
I understand now. I've never looked at std:string's constructor, still trying to understand OOP ;)
Your explanation about std::string's constructor answered that question, even though I wasn't...
-
November 27th, 2010, 10:18 PM
I read that C++ has a new type of assignment syntax that I can choose to utilize.
I.e.
int a(10); // C++ style
int a = 10; // C stlye
Sometimes this syntax fails, such as below:
-
November 27th, 2010, 09:59 PM
This tip alone cut my execution times in half, thanks a ton.
-
November 27th, 2010, 09:38 PM
I understand what you mean by passing by value and reference. Now when you say most objects, does that include things (don't know exactly the correct term to apply) such as shorts and doubles, etc? ...
-
November 27th, 2010, 07:42 PM
Yes, I meant to do x = 0; in the second example.
That article helped somewhat, I don't understand everything, but I do get the gist that initialization list are better to use than assignment in...
-
November 27th, 2010, 06:04 PM
That looks like just what I need, thank you.
-
November 27th, 2010, 05:58 PM
I encountered the following while reading some C++ code.
Consider these two code examples:
class Foo { // Declares class Foo
public:
int x; // Member variable
...
-
November 27th, 2010, 04:31 PM
I've recoded everything quite a bit, and I've tried to eliminate the use of char* or char[] (except when OpenGL returns one).
Another thing I found is that OpenGL version strings are always in the...
-
November 26th, 2010, 04:41 PM
I appreciate these tips. I can follow along with everything up to where you mentioned vectors. They still scare me. I will incorporate each of your suggestions above in turn. May as well try all...
-
November 26th, 2010, 01:06 PM
Okay, I played around with it and now I see what you mean, thanks for dispelling my illusion. Learning as I go along..
This is what I came up with to fix it:
char szVersion[6] = "\0";...
-
November 26th, 2010, 11:10 AM
But isn't that just the sort of thing using sizeof() is supposed to avoid?
It should make it whatever size the thing happens to be, that's how I've come to understand it.
I tried what you said...
-
November 26th, 2010, 12:42 AM
Even though no one answered I still felt people were listening.
Although it was a dumb mistake, I'm still proud of it in a way.
|
Click Here to Expand Forum to Full Width
|