Search Results

Showing results 1 to 40 of 66
Search took 0.01 seconds.
Search: Posts Made By: superjacent
Forum: Ruby Apr 20th, 2009
Replies: 1
Views: 1,568
Posted By superjacent
Here are some suggestions I've since received from other sources. In essence there is always more than one way to skin a cat.

for r in (1..rows)
for c in (1..(rows - r))
print "."
end...
Forum: Ruby Apr 20th, 2009
Replies: 1
Views: 1,568
Posted By superjacent
In learning Ruby I've dug out some old C++ exercises and one in particular which can be found here (http://prime357.net/node/80)deals with a for loop. I'm basically converting the C++ code to Ruby...
Forum: Ruby Apr 10th, 2009
Replies: 0
Views: 1,340
Posted By superjacent
How do I configure SciTE so that when code ( gets() ) asks for user
input I can enter that input via the output console. At present, all
that happens is a 'Terminate' button appears in the output...
Forum: Ruby Apr 6th, 2009
Replies: 4
Views: 2,540
Posted By superjacent
Thanks for the input so far. As regards JRuby, this is where, for me, it gets confusing. Is it Java or is it Ruby? Is is Java creating Ruby source code to be run entirely under the Ruby...
Forum: Ruby Apr 5th, 2009
Replies: 4
Views: 2,540
Posted By superjacent
I dabbled in Ruby quite a while ago but only at the console level. I didn't take it any further at the time. I'm now considering treating it more seriously this time, though I'd have to start from...
Forum: Show Off your Projects Apr 29th, 2008
Replies: 10
Views: 2,549
Posted By superjacent
What does it do? Should I be cynical?
Forum: C++ Apr 23rd, 2008
Replies: 3
Views: 2,783
Posted By superjacent
Thanks AD. I'm in the process of coming to grips with all or most of the basic cin uses and I was more concerned with why an error state is recorded when there is a newline left in the input buffer...
Forum: C++ Apr 22nd, 2008
Replies: 3
Views: 2,783
Posted By superjacent
I'm self studying C++ and I'm actually back-tracking a bit in order to clarify things. My question revolves around why in the following code is the cin.fail() == true.


#include <iostream>...
Forum: C++ Apr 15th, 2008
Replies: 11
Views: 3,082
Posted By superjacent
Good pick up. It appears that the variable ch needs to be checked prior to the switch statement. I've modified my original program that I posted at the top of this thread. What needed to be...
Forum: C++ Mar 17th, 2008
Replies: 2
Views: 718
Posted By superjacent
Thanks again. After posting this question, re-reading it, I sort of then realised that the missing argument had to be 'hardcoded' or be a 'string literal' at the definition. Probably the point of...
Forum: C++ Mar 17th, 2008
Replies: 5
Views: 45,755
Posted By superjacent
Thank you very much, this has certainly cleared things up. In a way, I'm glad I came across this problem, hopefully it won't catch me out again, when progressively compiling.
Forum: C++ Mar 17th, 2008
Replies: 5
Views: 45,755
Posted By superjacent
I'm self studying from the book, C++ Primer Plus Fifth Edition, by Stephen Prata. The following relates to Chapter 13, Page 699, Programming Exercise #4. One task is to write the derived class...
Forum: C++ Mar 17th, 2008
Replies: 2
Views: 718
Posted By superjacent
I'm self studying from the book, C++ Primer Plus Fifth Edition, by Stephen Prata. The following relates to Chapter 13, Page 699, Programming Exercise #4. One task is to write the derived class...
Forum: C++ Feb 29th, 2008
Replies: 7
Views: 916
Posted By superjacent
Oops straight back at ya.......lol
Forum: C++ Feb 29th, 2008
Replies: 7
Views: 916
Posted By superjacent
I think you mean when i is set to 6 it will fail, thus 5 iterations.

In relation to the original question, I would use a while loop with the test condition checking against the ever decreasing...
Forum: C++ Feb 29th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
You still need to call your function from main(). In main, simply initialise and assign three double variables and pass them into your function.

In main() something like this cout << mpg(d1, d2,...
Forum: C++ Feb 29th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
You need to at least write a main() program, that is the only way you will be able to test your mpg function.
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
What were the errors.
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
Try it in a program........see what happens....
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
Ok, here's the formula:

miles travelled / (size of tank - gallons left) = mpg.

mpg is miles per gallon.

miles : 1000
size (gallons) : 60
left (gallons) : 10
1000 / (60-10) = 20 mpg.
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
Ok, I can see where you are confused and I apologise accordingly. I re-read your initial first post and I skipped the bits about the information to be input being 1. size of tank, 2. gallons left...
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
miles / gallons = mpg
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
It's the same function, you haven't made any changes.

By the way, in the context of your function the variable 'numberofmilest' first needs to be initialised as a double.

Have you tested this...
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
Do you notice in your function that you are passing in three arguments. To work out miles per gallon, you only need two arguments (miles and gallons). Do the calculation in the function (using...
Forum: C++ Feb 28th, 2008
Replies: 23
Views: 1,903
Posted By superjacent
Think of it this way. You have two known pieces of information (gallons used and miles travelled), that is all you know. The third piece is what is calculated and is the purpose of the function -...
Forum: C++ Feb 28th, 2008
Replies: 5
Views: 1,284
Posted By superjacent
Forum: C++ Feb 27th, 2008
Replies: 5
Views: 1,284
Posted By superjacent
Thanks all for responding, very much appreciated and it's certainly cleared the air for me. I've had to go back a chapter and re-read up on implied constructor conversions. I'm now left with this...
Forum: C++ Feb 27th, 2008
Replies: 5
Views: 1,284
Posted By superjacent
Hope someone can clarify. I'm self-studying and my question relates to Programming Exercise # 2, Chapter 12, C++ Primer Plus Fifth Edition (pg. 629). I completed the exercise and achieved the...
Forum: C++ Feb 21st, 2008
Replies: 6
Views: 641
Posted By superjacent
There is no need to initialise and declare the return value, in this case. It's returned directly without first assigning it to a variable. If you wanted to, you could initialise and assign to a...
Forum: C++ Feb 5th, 2008
Replies: 9
Views: 715
Posted By superjacent
Forum: C++ Feb 3rd, 2008
Replies: 2
Views: 798
Posted By superjacent
I'll give you one thing, you've got more front than Myers (substitute 'Myers' for any major department store in your area) but maybe that's just me being cynical.

What type of program are you...
Forum: C++ Jan 31st, 2008
Replies: 5
Views: 2,864
Posted By superjacent
Thank you all. This is now resolved. I fell victim to not reading the question properly.
Forum: C++ Jan 31st, 2008
Replies: 5
Views: 2,864
Posted By superjacent
That is what I thought. To recap:

Move add(const Move &m) const;
// this function adds x of m to x of invoking object to get new x,
// adds y of m to y of invoking object to get new y,...
Forum: C++ Jan 31st, 2008
Replies: 5
Views: 2,864
Posted By superjacent
I'm learning C++ from C++ Primer Plus, 5th Edition, and have come across the following problem.

The following class declaration is given as part of the question:

/*
Name: move.h
...
Forum: C++ Jan 30th, 2008
Replies: 8
Views: 1,807
Posted By superjacent
I'm not really following the point of this thread. I can't see what the problem is. (other than a cranky professor) At the end of the day, you have to hand in your assignment and no doubt it's the...
Forum: C++ Jan 29th, 2008
Replies: 1
Views: 1,097
Posted By superjacent
It seems like this is an ambitious project or assignment for someone who doesn't understand the basics of classes. I would have thought your class (as in school) would have eased you into this and...
Forum: C++ Jan 28th, 2008
Replies: 9
Views: 910
Posted By superjacent
What did you do to resolve the problem?
Forum: C++ Jan 28th, 2008
Replies: 8
Views: 728
Posted By superjacent
eesti44 it appears we're working from the same book, C++ Primer Plus, 5th Edition, and at the same chapter doing the programming examples. I've just completed this particular exercise and it gave...
Forum: C++ Jan 28th, 2008
Replies: 5
Views: 2,420
Posted By superjacent
Thank you once again, I quickly added a blank int main() function and it compiled without error. I shouldn't forget this gotcha in future.

ps. I probably should have created a new thread for my...
Forum: C++ Jan 28th, 2008
Replies: 5
Views: 2,420
Posted By superjacent
Thank you, how did I not see that.

I'm now getting another compiler error indicating this [Linker error] undefined reference to `WinMain@16' .

From another editor, Programmers Notepad,...
Showing results 1 to 40 of 66

 


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

©2003 - 2009 DaniWeb® LLC