Search Results

Showing results 1 to 40 of 156
Search took 0.01 seconds.
Search: Posts Made By: JasonHippy ; Forum: C++ and child forums
Forum: C++ 5 Days Ago
Replies: 8
Solved: return question
Views: 274
Posted By JasonHippy
Fair point! I was probably oversimplifying my explanation there. But as ever, you've summed things up far more succinctly and accurately than my own fumbling attempt! Thank you Narue! :)


I know...
Forum: C++ 5 Days Ago
Replies: 7
Views: 330
Posted By JasonHippy
Yes it is possible.

If you've been having trouble trying to do this, I'm assuming you were doing something like this:
pResult = p1 + p2
Which is definitely not what you want to do. The compiler...
Forum: C++ 5 Days Ago
Replies: 8
Solved: return question
Views: 274
Posted By JasonHippy
Well, lets look at that in terms of my definition of what return does:
return exits the 'current function' and returns to the 'calling function' passing an appropriate value.
In this case, the...
Forum: C++ 5 Days Ago
Replies: 8
Solved: return question
Views: 274
Posted By JasonHippy
OK, I'll try to explain this as simply and accurately as I can.

First though, a note on functions:
All functions must return something...Anything, even if that something is actually nothing (if a...
Forum: C++ 12 Days Ago
Replies: 14
Views: 318
Posted By JasonHippy
Have you tried using ios:: flags on the file open instead of the fstream:: flags?
Perhaps try:

fstream file ("myFile.dat", ios::out | ios::binary | ios::app);


Does that make any difference??...
Forum: C++ 13 Days Ago
Replies: 4
Views: 228
Posted By JasonHippy
Well you're very nearly there!
You said you wanted to find out how many items in the array were greater than 100, that would imply that you need some kind of counter, which is the missing ingredient...
Forum: C++ 13 Days Ago
Replies: 20
Views: 674
Posted By JasonHippy
Wow, this thread went kinda crazy for a simple little thing didn't it!
Heh heh!


Oops, I didn't spot that! I cut 'n pasted the OPs code and made some very minor adjustments..Very shoddy of me!...
Forum: C++ 13 Days Ago
Replies: 20
Views: 674
Posted By JasonHippy
Try this:

#include <iostream>
using namespace std;

int main()
{
cout << "Hello World /n";
return 0;
}
Forum: C++ 13 Days Ago
Replies: 2
Views: 174
Posted By JasonHippy
OK, I'm not sure if this is something I've dreamt up during some wierd geeky dream (or nightmare!) or whether I've actually seen something about this subject before.

If I have seen this somewhere,...
Forum: C++ 14 Days Ago
Replies: 4
Views: 181
Posted By JasonHippy
You can't pass the filename like that, that's just passing "args[1]" as a string literal you need to do something like this:

// build the string..
std::string command = "fc " +...
Forum: C++ 15 Days Ago
Replies: 6
Views: 197
Posted By JasonHippy
Have you tried running your code through a debugger?

If you take the call to fabs out of your return statement in your operator== overload and store the result in a variable and then step through...
Forum: C++ 15 Days Ago
Replies: 5
Views: 180
Posted By JasonHippy
Well think about it!

Take another look at Narue's example and apply that to your problem...

Narue's example uses ints rather than your 'sample' class, but most of the code reflects what you...
Forum: C++ 19 Days Ago
Replies: 1
Views: 195
Posted By JasonHippy
Take a look at my response to this thread:
http://www.daniweb.com/forums/thread242984.html

That should give you all the information you need.

Cheers for now,
Jas.
Forum: C++ 19 Days Ago
Replies: 11
Views: 324
Posted By JasonHippy
Well, for starters, it's not an ugly solution at all!
It's common sense and good practice! When constructing an object all members should correctly initialised. If you don't know what the value of a...
Forum: C++ 19 Days Ago
Replies: 7
Views: 287
Posted By JasonHippy
Well other than what's already been mentioned, reading as many technical C++ books as you can get hold of might also help.

I'm not going to mention any books here though because there's a sticky...
Forum: C++ 19 Days Ago
Replies: 11
Views: 324
Posted By JasonHippy
The whole point of a constructor is to initialise any member variables in your class.
If members are not initialised correctly at construction, then you are at risk of inroducing all manner of bugs...
Forum: C++ 19 Days Ago
Replies: 7
Views: 287
Posted By JasonHippy
Despite working as a programmer for several years, I wouldn't consider myself an expert per se. I'm still learning new things every day. But I'd have to echo what niek_e said and say that the main...
Forum: C++ 20 Days Ago
Replies: 1
Views: 171
Posted By JasonHippy
There are several problems I can see in your code.

This is one of them:

total += answer;// add the answer to total value


So each time your user answers a question (whether they were...
Forum: C++ 20 Days Ago
Replies: 2
Views: 260
Posted By JasonHippy
I've recently started looking into this myself...
With regard to out of the box GUI functionality:
AFAIK It depends on the desktop/window managers a linux distro uses:
e.g. Kubuntu, OpenSuse and...
Forum: C++ 20 Days Ago
Replies: 3
Solved: a code an error
Views: 175
Posted By JasonHippy
Your GetData and GetSize functions need to be declared const
e.g.

unsigned GetSize() const // This
{
return n;
}
Forum: C++ 21 Days Ago
Replies: 2
Views: 306
Posted By JasonHippy
Hey Tonka!

Wouldn't it make more sense to use a structure (struct) to store the name, age and score for each person and then use one array of structures instead of three separate arrays?
That way...
Forum: C++ 23 Days Ago
Replies: 4
Views: 285
Posted By JasonHippy
Take a look at this page:
http://msdn.microsoft.com/en-us/library/b9skfh7s.aspx

Assuming that the other processes you mentioned are programs that you've written and as long as I understood the...
Forum: C++ 23 Days Ago
Replies: 9
Views: 426
Posted By JasonHippy
Aha, thanks Narue, that was beginning to bug me!
I've not done anything much with unicode, so I've never come across that particular problem before. But I guess that would make sense!

I shall...
Forum: C++ 23 Days Ago
Replies: 9
Views: 426
Posted By JasonHippy
Hmm, That's very odd!
After looking into this, Niek e's example compiles ok for me and outputs the strings properly.
I'm not sure why you're seeing the addresses of the columns instead of the...
Forum: C++ 23 Days Ago
Replies: 17
Views: 478
Posted By JasonHippy
The reason you're not getting any output is because by the time you've got to the end of the Life function, all of your original generation of bacteria are utterly annihilated, dead, gone, pushing up...
Forum: C++ 23 Days Ago
Replies: 9
Views: 531
Posted By JasonHippy
OK, if you need a fresh pair of eyeballs to go over the code, .zip up all of the source files for your project and post it here as an attachment, I'd be more than happy to take a look at it for you!...
Forum: C++ 25 Days Ago
Replies: 2
Views: 388
Posted By JasonHippy
Using strings would be preferable. However, if this is for an assignment and you have to use c style strings; in your function you could copy the original string into a 2nd character array. Then...
Forum: C++ 25 Days Ago
Replies: 9
Views: 531
Posted By JasonHippy
Hmmm, that's odd. That looks like it should correctly update the objects balance. Have you tried using the this pointer to refer to the balance?
e.g.

this->balance -= amount;

That might just...
Forum: C++ 26 Days Ago
Replies: 9
Views: 531
Posted By JasonHippy
OK, well take another look at your code...
When the Bank::withdraw function is called, a pointer to the relevant account is obtained. If the account balance is >= the amount, then the withdraw...
Forum: C++ 26 Days Ago
Replies: 4
Views: 433
Posted By JasonHippy
Personally I'd copy the sentence into a stringstream object and then use the stringstream's >> operator to separate each word from the sentence and store each word in a vector of strings.
Like this:...
Forum: C++ 26 Days Ago
Replies: 1
Views: 283
Posted By JasonHippy
Personally, I'd leave only the declarations of the member variables and functions for your class in the header file and then put the definitions of the functions into a .cpp file which has a filename...
Forum: C++ 33 Days Ago
Replies: 9
Views: 429
Posted By JasonHippy
Ah, hello again Narue.
Once more you've quite correctly corrected me on my half-witted absent-minded inaccuracy!


Oh yes, of course {memory kicking in..albeit slowly!} I forgot about...
Forum: C++ 33 Days Ago
Replies: 9
Views: 429
Posted By JasonHippy
OK, try this on for size, this uses references as parameters to the two functions..

#include <iostream>

using namespace std;
...
Forum: C++ 33 Days Ago
Replies: 9
Views: 429
Posted By JasonHippy
OK, well for starters you don't want a goto in makeEven, you want to return something....
Also in main you'd need to assign the value of x to the value returned by a call to makeEven(x).

That...
Forum: C++ Nov 12th, 2009
Replies: 2
Views: 330
Posted By JasonHippy
From looking at the code, it seems to me that if you run your debugger and step through the program you'll find that line 34 will fail to read anything from the input file.

The reason for this is...
Forum: C++ Nov 11th, 2009
Replies: 7
Views: 298
Posted By JasonHippy
Glad to have helped! :)
Forum: C++ Nov 11th, 2009
Replies: 7
Views: 298
Posted By JasonHippy
Oh I see you've HAD to implement your own queue class as a part of your assignment...sorry I thought you were just over complicating things for yourself.

In that case, to turn your class into a...
Forum: C++ Nov 11th, 2009
Replies: 7
Views: 282
Posted By JasonHippy
dkalita has already explained it to you...Try reading his post again!

The function 'fun' returns an int.
But it takes a pointer to a function as a parameter.
The function pointer must point to a...
Forum: C++ Nov 11th, 2009
Replies: 7
Views: 298
Posted By JasonHippy
It seems to me that you are over complicating things. Wouldn't it be a lot simpler to just use a double ended queue, otherwise known as a deque?
Modifying your code from one of your previous posts...
Forum: C++ Nov 10th, 2009
Replies: 1
Views: 289
Posted By JasonHippy
The thing that's confusing me is how you're getting a syntax error from a data-file!!

How are you running the program and passing the parameters? Are you running it from the command line? or from...
Showing results 1 to 40 of 156

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC