Type: Posts; User: math8
Search took 0.01 seconds.
August 19th, 2013, 08:06 PM
I think I can use an ArrayList and an 'enhanced for loop' to loop through all its entries. I was hoping there was a way to refer to the 'argument's number' of a method, but apparently not.
August 19th, 2013, 02:38 PM
My question is, is there a way for the method to loop using each of its arguments one by one?
For instance, in the code below, is there a way to write the line "M[i] = argi;" in a correct way so...
August 17th, 2013, 01:47 PM
I am not trying to change the number of arguments the method has, I am just wondering, just like you can find the number of entries an array arr has by typing arr.length, is there a way to find the...
August 16th, 2013, 09:58 PM
hmmm, by thinking about this a little bit more, I think this should work:
double M = new double[a.length];
But still, let say, instead of two arrays, I have two...
August 16th, 2013, 07:51 PM
say I have two int arrays of length 3 (ex: a = [ 1 2 3] and b = [4 5 6])
I would like a method that returns the 2x3 Matrix:
1 2 3
4 5 6.
I have tried using
March 5th, 2013, 02:47 PM
March 5th, 2013, 12:08 PM
I know a virtual function is a member function of a class whose functionality can be overridden in its derived class.
If you have a virtual statement, do you need to assign your destructor as a...
February 21st, 2013, 07:50 AM
alright, but aside from that, what is wrong with what I wrote before?
February 20th, 2013, 11:22 PM
hmmm, let see. Maybe something like:
for(int i=0; i<=n/10;i++)
x=i; //number of 10's
z=(n-(i*10))/25 ; //number...
February 20th, 2013, 11:08 PM
I wasn't sure what you meant by "evenly". But first of, intuitively, for this problem to make sense , the "cents part" n must be either 0 or >=10 and at least n must be a multiple of 5 .
So the only...
February 20th, 2013, 10:41 PM
when you say "evenly" do you mean by solving: 25x+10x=y, where y is the cents value?
February 20th, 2013, 09:59 PM
The code below gives me the maximum odd number and the minimum even number of a list of numbers that the user type. However, for the loop to stop the user needs to type 1000. Is there a better way...
February 20th, 2013, 09:48 PM
I think the code is performing how it should, I think the problem is behind the logic (I guess that's the design). I am hoping to get 23 10's, one 5, two 1's ,2 quarters and 3 dimes.
February 20th, 2013, 03:19 PM
yeah, it should, my bad. Unfortunately, it doesn't.
February 20th, 2013, 03:08 PM
My coin/money change code works when there can be an exact change each time, i.e. when the 1 cent option is available. However, when the change options are only $10, $5, $1, 25 cents and 10 cents, it...
February 20th, 2013, 02:32 PM
Never mind! found the error!! I needed to change the () into a  in eKey(i), because eKey is not a function .
February 20th, 2013, 02:26 PM
I have two functions bool check_key(string cKey, string eKey) and bool check_digit(char digit1, char digit2), and I have declared both of them globally (is this the right terminology?) right after...
February 13th, 2013, 08:28 PM
February 13th, 2013, 06:04 PM
I am trying to add matrices a and b. I am getting an error in the "add" function, probably because I have m[i] in it, and m is not an array. What is the correct way of writing the "add" member...
February 13th, 2013, 11:43 AM
hmmm, I rearranged some things around, and this is what I came up with.
using namespace std;
February 13th, 2013, 10:36 AM
Thanks, I will keep that in mind.
However, I am running into this new problem: In the void Frequency function that I had , besides calculating the frequency, it was also calculating the number of...
February 12th, 2013, 10:59 PM
Alright, I see what you are saying. But technically speaking, in my method, I write the same amount of text "cout<< / file2<<" - wise (except that I have 2 different but similar functions to call as...
February 12th, 2013, 08:30 PM
Could you give me an example of a function of type double, float,or char that can return some text both for the screen and for the ouput file. I tried earlier, and I couldn't make it work, that's why...
February 12th, 2013, 08:02 PM
I just figured out what was wrong.
I cannot use the same function Frequency when printing out on the output file. I had to create a copy of the Frequency function and in the new one, I replaced...
February 12th, 2013, 05:50 PM
Thanks, I can see it is an error. If I wanted to get the results of void Frequency(alphabet[p], num, a) on the screen, I would just write
Frequency(alphabet[p], num, a) ; (with no cout<<). However,...
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!