jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Finally, here is my question ***My e-mail In-box is full of Dani-Webs, not the Dani-Web In-box. I'm almost at maximum capacity. Without deleting these Dani-Webs or unsubscribing to them; how do I keep them without going over the maximum capacity?*** I created a special folder for this, but have the same problem.

That totally depends on what email program you use. There's usually a way to save to a folder locally or export some messages as text.

I see now, it's just a matter of keeping track of the post number to collapse/expand post.

Removing the post number forces the quote to be expanded all of the time (for us curmudgeons that liked that as the default). Simply quoting the text translates it to the box that can expand or contract.

Agapelove68 commented: Quotes I get it yea! Post, I don't yet, but your noparse trick worked! :) +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You don't need to do it in WPF (using that with C++ is one of those things that's theoretically possible, but not really doable anyway), the GDI+ stuff works in C++/CLI. I'll try to throw together a sample at some point.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Also, take the return from your function into winnings up in main(). The local variable in the function bears no relation to the one in main().

coinswon = evalPayout(spin_result[1][0], spin_result[1][1], spin_result[1][2]);
coinswon+= evalPayout(*those for the other row*);
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was just looking at that, and I think that would work (I did not test it yet). You'll have to adjust your function prototype at the top too. Also, you were missing <iomanip> from your headers.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Which type of strings are you using? (C-strings or std::string) If you are using std::string, then there are methods like .find() which will work. Since it is your assignment, you probably can't use the built in methods, so the easiest way is to treat the string like an array and step through it via a loop looking for ','

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Move displayPoll() outside of your while loop if you only want it to display once.

Also, main() is never void, it always returns an int.

I see what you are trying to do with the first element of the array. Well, make it of length 6 instead of 5 and all of those indexing issues go away.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I meant line 20, not line 26, sorry. But you are also trying to increment an element that's out of bounds on line 90. Your array elements go from 0 to 4 for a 5 element array. Fix that and I'll look at the rest of it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Now, is it a good idea to start by drawing all this do you think?

Are you asking if you have to implement the GUI? I would say that you probably don't.

The operator you want to focus on is == so that you have a way of evaluating whether two rectangles are equal (hint, you have their width and height as variables within the object) and whether two points are equal (their x's are equal and their y's are equal).

See if you can get some of the basic framework set up. Use an example from your text or one online.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Search for "STL Vector" in youtube or otherwise. A bunch come up. I don't know what your needs are, so pick the one you like.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What is specifically wrong with the code?

Also, look at line 26, your array has 5 elements VoteArray[0],VoteArray[1],VoteArray[2],VoteArray[3],VoteArray[4] . Your loop is trying to access element 5 which doesn't exist.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In evalpayout look at the line if(A[x][0] = 2 && B[x][1] = 2 && C[x][2] = 2) and all of the others like it. You have used the equality operator (=) instead of the comparison operator (==).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What exactly is the problem?

Hint, lines 53, 60, 62, your comments do not match what you have written there. You are overwriting the value, not adding to it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One thing is, you need to treat the outer border (column 0 and 21, row 0 and 21)as special so you don't go out of bound on your array. For example on line 100, in cell (0,0) it tries to read lifeGrid[-1][-1]. You may be lucking out and there might be junk at that address, but usually it should just crash. Cells in the top row should only check the row below and each side, etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The mainstream library (http://sourceforge.net/projects/opencvlibrary/) does work under C++, and a couple of people around here are familiar with it (I've built against it before, but nothing fancy), but I agree with ravenous that it would be helpful to see the compiler error.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Here's a few to get you started:
In main, C is half the size it's supposed to be
In merge, which is the biggest problem, on line 15 B should be A, on 16 should be count1-1 (as the last element of a SIZE array is SIZE-1) and on 17, size should be count2. On line 22, trace it by hand and you'll see you're falling of the end of the array.

I'm sure there are more errors, but those are the glaring ones I saw.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You could overload the < and > operators for your class (which simply compare the prices of two different items)

See: http://www.learncpp.com/cpp-tutorial/94-overloading-the-comparison-operators/

Diogo Martinho commented: Thank You +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What is it not doing? (or what is it doing that you didn't expect?) In other words, point us in a direction. Also, posting a snippet of your data file would allow someone to test it.

Also, when you have written in a 1 element array, you don't need it. Just use a regular variable.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

total, SIZE, and avg are all ints. Change avg to a double and cast either total or SIZE (or both) to a double. double avg = (double)total/SIZE; Even though avg is a double, the result of int/int division is in integer and therefore truncated.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

>>lblName->Click += gcnew System
You do NOT use += in that line, just =.

No disrespect, AD, but it is correct. += is overloaded for events (which are really delegates in disguise) so that you can chain more than one event handler to a single event.

See http://www.functionx.com/vccli/general/events.htm (about 3/4 of the way down the page)

Add this to the ways that .NET has tried to corrupt our peaceful C++ lives.

kvprajapati commented: Ha ha! +11
Ancient Dragon commented: Thanks for the clarification +34
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Change the first if statement to if(screen == false) or if(!screen) and for the second one if(screen == true) or if(screen) .

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Okay, good start. Now what is the issue with it? Which portion doesn't work?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Watch out Peter, you're not the only game in town! :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No, the specifics aren't important, I think I see more of what you're driving at now. Again, not anything that I could come up with (short of a giant #define, but I'm not so sure that would even work). See what other people think...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The problem is that this block of code cannot be placed in a function, and I don't want to copy/paste it twice.

Maybe I'm not reading that right, but what is your requirement for this block?

And no, you can't assign a for loop to a variable.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It compiles fine apart from this and I am not sure if somehow I've coded it wrong, although then it should have thrown up compile errors? (Lost)!

"Site web computer far opens" will pass your spell checker (and maybe even some grammar checkers) but it doesn't make much if any sense in English. The compiler will pass anything that matches its set of rules whether it runs or not.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You could use .find() - see the examples at http://www.cplusplus.com/reference/string/string/find/ (there's an overload for a character to be matched)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please continue to use the code tags.
The problem the compiler is talking about is here: while (studentgrade!= -1) You have studentgrade1 in all the other places.

Your loop has to wrap around your input as well. I'm not sure how you think the while loop at the bottom will count anything. //Then program should notice and count there's 1 a so far How is it supposed to do that?

Just set up a do/while loop that takes input until you input -1. Try that in a program without any of the other statements.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

This has gotten far enough off topic, but,caut_baia, I direct you to http://www.daniweb.com/forums/post3625.html#post3625

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I took entire courses on code tags and forum posting :) I'm not an IT Pro, but I play one on TV.

noparse is just another tag that says, don't translate any of the tags that are in between the noparse tags, so you can type something like "please use [noparse][code] code tags [/code] [/noparse]" It's a handy trick.

You can't post something with just a quote. Let the system do the work for you, as you can always experiment and edit your post afterwards.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

OP, please cover your ears for a second. :)


caut_baia, you have been asked repeatedly not to give the answer away. This teaches the OP nothing. Please let me know what your difficulty is in understanding this.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Our posts crossed. That's a good idea. You'll need some sort of loop structure.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No, I understand exactly what you are trying to do. Your writing was fine. The issue is you need to plan out what your program is to accomplish instead of coding lines.

My point is, you're incrementing the counters once at the end of the program and the increment is not related to the grades you are inputting at all. You're also only taking in 2 grades, and presumably you want a flexible number depending only on what the user inputs.

Start out with small pieces. I've said you need a do/while loop. If you don't know what it is, read your text to see the syntax. You need something like what you have to identify the grades, but you also want to increment the count of A's at the same time as you are identifying the grade as an A.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

main() always returns an int.

Here's what your code is doing:
All the counts are zero.
You ask the user for one input.
You output the grade
You ask the user for another input.
You output the second grade.
You increment the counts by 1.

Is that what you want it to do?

Lance gave you a huge hint, you want to increment the counts when you've classified the grade as A,B,C,D, so you are on the right track.

Also, you want to enclose the whole business in a loop so you can get grades until the user enters -999 or something. Look into a do/while loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post your current code, no one is going to be able to help you if they can't see your errors.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Isosceles triangles have 2 equal sides, equilateral triangles have 3 equal sides. Therefore, what can be said about equilateral triangles? Determine whether or not there is a relationship between right angle triangles and either of the other two.

Write out your thoughts and someone will be able to tell you if they are correct.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

New members won't know what "inline code" is. IMO the entire explanation for [ICODE] tags should be removed in the read me's, to keep it nice and simple for newbies.

Also, I don't know how many times I've seen people frame code as [code] [/icode], which makes an unformatted mess, so I agree it's confusing as it is.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

@Jason

main() always returns an int according to the standard

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think you'll want something like this:

MyClass * ObjTest1 = new MyClass(var,var1);
MyClass * ObjTest2 = new MyClass(var2,var3);
std::vector<MyClass*> vecTest; //your method requires a vector
vecTest.push_back(ObjTest1);
vecTest.push_back(ObjTest2);
Attr1 = ClassObjAnother.FindObj(vecTest,ObjName_)->GetAttr1();

. and -> are of the same level of precedence, so that statement should do what you want it to, since it proceeds left to right. If you want to clarify your intentions you can put the parens around the first part for readability.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In your bottom listing, you don't need another iterator in the calling function, as ClassObjAnother.FindObj() will return an item of Obj*. In your method (first listing), you are returning a dereferenced iterator, which is the object contained in the vector at that location. If you want an iterator, have you method return an iterator instead.

You don't need the * after ObjectTest in any case, that is not correct notation, but your method is looking for a vector of such objects anyway.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Well, you're not going to use conio.h (as just copying that header over into Linux won't do you a bit of good), but for whichever one of those libraries you choose you will have to specify the include directory and the library directory (how you do that depends on which compiler you are using). The <> are used only for libraries that are in the search path of the compiler.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

*nix has Curses for the same purpose (and there are versions like pdcurses, pdcurses.sourceforge.net that are portable across systems). I looked at libconio and it seems to be poorly documented (presumably, and I don't like making these kinds of assumptions, but it probably has the same functions that conio does). Unfortunately, this type of function is not part of standard C++ so you are looking at portability issues no matter what. See if you can work around using them.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you look up mysql_query it returns an int, 0 upon success and non-zero for failure. What do you want to print out from the query?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

On line 5 there, you have the dereferencing operator ('*') on the wrong side. Presumably that line is dereferencing an iterator that's not listed...

In the second listing, you need to pass the name of your std::vector<Obj*> into your method (in the same way that you've passed the method "NameObj_" instead of "string").

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

To post quotes as automatically expanded hit "Post Reply" and go to where it says "[QUOTE=happygeek;1408366]".

Just click where it says 'Click to Expand/Collapse' and the quote will, erm, expand or collapse.

Now delete the ";1408366" (or whatever the post number is)

Agapelove68 commented: Thank you jonsca for the specific instructions. I'll eventually catch on. I'm quick to attentiveness, but at times still lost here. :) +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See this: http://www.bobpowell.net/faqmain.htm

Caveat is the examples are in C# and VB.NET, but the usual dot used for namespace in C# changes to C++ :: ,and dot used for member method in C# changes to -> (if the variable in question is a pointer) will apply. Look on MSDN to confirm the syntax if need be.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's looking for the function definitions of lines 39-41. Where are they implemented?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm not very sure about stacks

You can certainly ask more questions. I was just giving you a general source. It's not something I would worry about for now, though.

'check for reaching the end of words'

If you are putting in a space when you type done it's all taken care of, but if you don't you should add one in within your program to make sure it will stop (otherwise it runs to the end of the array (1001) no matter how many characters you put in).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

How to I move it to C++?

All set, a mod moved it.

I haven't gotten to the ReadRec and DisplayRec yet. I'm trying though.

The issue is more that the design of those functions will dictate how they will be used in main() so it's tough to help. You'll probably want to move your while loop inside of your function rather than the other way around.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

i left u a bug here.

Rather than do that, guide the poster to the right answer without any of this bug squashing.

try and solve and avoid isdigit()

And your reason is? In reality, you can do it without either by using the characters in the comparison (e.g., c < '1'), but I don't want to steal all the fun.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try instantiating a istringstream

istringstream iss(temp); //before line 7
if(!(iss >> e)) e = 0;