80 Posted Topics

Member Avatar for C.Cen

That's the problem. When day is 30, your cout statement increments it to 31, from where you try to read in the stock price for stock[31] which gives you a problem. Rather than using ++day, use day + 1, since it doesn't increment day. Also, if you're using floating point …

Member Avatar for DHEERESSAA
0
244
Member Avatar for jacob07

[CODE]string str; getline(cin, str, '\n'); // '\n' is the delimiter [/CODE]

Member Avatar for jonsca
0
157
Member Avatar for biancaW

Along with what L7 mentioned, in your while loop leftName and rightName isn't updated and neither are your i or length variables. Also, you'd never actually begin the loop, since you're testing 0 != 0. If you are doing an anagram, are you just trying to scramble the characters in …

Member Avatar for L7Sqr
0
407
Member Avatar for DaniwebOS

You've hit the nail on the head. You'd want structure in your programs, especially if it's a big one. In addition, separating the files keeps functions that are related confined to one area. Keep it simple.

Member Avatar for DaniwebOS
0
70
Member Avatar for Marcial

What moschops was referring to was creating a variable of type string, rather than one of type char[]. That way, you'd be able to read in any name and test whether or not it's equal to "Jeanne" using the compare function. Along with this, if you're initializing name to "Jeanne", …

Member Avatar for Marcial
0
205
Member Avatar for fadi_1234

Using static_cast isn't really an advanced way. I mean, if you want the simplest then following the advice to simply assign it to an integer variable should suffice. You can always add a comment explaining what it does, just to make your intentions clear.

Member Avatar for fadi_1234
0
144
Member Avatar for Akill10
Member Avatar for RyanMcMillan
0
154
Member Avatar for Tinee

In your reverse function, even though you're passing r1, it isn't changed. You're only making changes to r2, which is local to your reverse function.

Member Avatar for Arbus
0
177
Member Avatar for Khoanyneosr

guess is declared to have a size of 50, but ranges from 0 - 49, right? You're trying to read into guess[50] which should be outside of the range. Another thing, why declare a size of 50 if you're only apparently using one string to hold the guess? Keep in …

Member Avatar for daviddoria
0
191
Member Avatar for Vindal

Even if you set MAX_ACCOUNTS to be 5, your do while loop still checks that counter is less than the integer 10 rather than MAX_ACCOUNTS, assuming that 1 is continually entered after counter surpasses MAX_ACCOUNTS. You'd be pretty much trying to use an object that you never created, is what …

Member Avatar for Vindal
0
171
Member Avatar for Wheaties

I'm not sure if this is what you're leading towards, but you can always allocate memory during execution with malloc and a given size.

Member Avatar for WaltP
0
228
Member Avatar for AODfan
Member Avatar for AODfan
0
124
Member Avatar for d0csss

As caut mentioned, you can't read in with a comma. In addition, you could always make the class variables private and use a member function to set them rather than allowing main() direct access to them.

Member Avatar for Chilton
0
90
Member Avatar for ottilie

You're counting how many times the function is called recursively, correct? If that's the case, then you'd need a counter. Still, it wouldn't just be any counter though. You'd need one that retains its value even after it's used again. This looks like C++, so think of a what is …

Member Avatar for apines
0
129
Member Avatar for latszer

Also, for future reference, the = sign signifies assignment. Later on, if you're comparing, for instance, numeric values then a double equals sign == is used to check for equality. But, as the poster above me mentioned, used strcmp to compare strings.

Member Avatar for Narue
1
221
Member Avatar for matrix0978

I believe j should be assigned the value of i, seeing that after the completion of the inner loop, one value would be sorted, hence not needing to start the search from subscript 0 again.

Member Avatar for matrix0978
0
243
Member Avatar for leena_gc

Do you want to know what source code is, or do you want someone do to your assignment?

Member Avatar for sheikaman
0
165
Member Avatar for ssDimensionss

Your program is using the array subscript to serve as a node which is the problem. Even though you removed the data, the second subscript, pq[1], isn't going to change. Have you tried doing it with a linked list?

Member Avatar for ssDimensionss
0
192
Member Avatar for tjackson

In C, arrays start with 0. In your case, you'll always be adding some data out of the preallocated boundary you've set when declaring your array. Also, your code is confusing the way it's structured there. Use the code tags to situate your work better. Here's hoping it helps.

Member Avatar for Chilton
0
145
Member Avatar for thebluestar

It should actually be "<= k" rather than less than. Use 9 as an example and you'll see. The for loop ends and fails to mod 9 against 3, hence returning a value of 1.

Member Avatar for thebluestar
-1
150
Member Avatar for hedwards09

Your code is in the wrong section though. Maybe asking if it can be moved to the Java section would garner better help.

Member Avatar for Chilton
0
149
Member Avatar for imolorhe

Well, you can start off with the first two: 2, and 3, and store them in an array. From there, think of the conditions for a number to be prime and implement it, keeping in mind to compare each successive value against the prime array. Here's hoping it helps.

Member Avatar for Chilton
-3
164
Member Avatar for vivek01anand
Member Avatar for Iam3R
Member Avatar for spatel14
Member Avatar for Chilton
0
133
Member Avatar for rohanvijay

Rather than asking others to do the assignment, a little bit of research would go a long way. [URL="http://scriptasylum.com/tutorials/infix_postfix/algorithms/infix-postfix/index.htm"]Read and understand.[/URL]

Member Avatar for Chilton
0
175
Member Avatar for wangatang126

Also, your code is overly complicated. Since you know the stopping value "maxElements", why not loop around that number of times while calling the pow function?

Member Avatar for neithan
0
158
Member Avatar for wangatang126

Why are there unused local variables in the function power? Also, bear in mind that your function is designed to take two arguments, yet you only supplied one in the function call.

Member Avatar for Grn Xtrm
0
189
Member Avatar for afnan1
Member Avatar for Chilton
-1
136
Member Avatar for 2fac323

You can create an array of structs that can hold those three pieces of data. Afterwards, sorting based on the hours can be done, starting with those from hour 0 - 23.

Member Avatar for Chilton
0
135

The End.