Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
nested-if
- Page 1
Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by jprog1000
… class. When I tried creating a new ball in the
nested
loop that checks for collision (used an array list), and…
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by toneewa
Some minor syntax fixes. Some things to consider are the collision and distance of drawing the next ball. A ball inside a ball's radius will cause numerous collisions. Even the starting ball locations can be already causing collisions. I added a collision counter display. Increased the maximum balls to make to 50. The timer delay can also impact …
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by jprog1000
Thank you so much for your reply and additions! It is certainly working as I wanted. I will read through the code you have added and ask you any questions I might have. I hope you don't mind. Regards
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by Dani
I’ll mark this question solved :)
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by Dani
… oh, sorry, missed the bit about you still needing clarifications. Feel feee to ask :) I’ll now unmark this topic as solved. /facepalm
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by toneewa
I cleaned up the code some more. Removed some things that were not being used. I ran into a couple problems which caused the freeze you mentioned. It was memory heap space and array allocating. E.g., if x or y becomes negative, and also infinite recursion. I added a x/y coordinate display for a ball, and tinkered with the placement of the …
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by jprog1000
Hello, Thank you again so much! All your additions are clear, but it seems like whenever two balls collide, more than one ball is added to the arraylist and painted. Any way to have just one ball added to the panel for every collision? Have some kind of a toggle flag in paintcomponent? Regards
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
2 Months Ago
by toneewa
Yes, this is true. Overlapping ball spawns can do that causing a chain reaction. Something like that could be done. How you handle the spawning of the new ball is what I played with a bit before. You will see better collision detection changing to: g.fillOval(ball.getX(), ball.getY(), 1 * ball.getRadius(), 1 * ball.getRadius());
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Month Ago
by jprog1000
Got it. Thank you so much!
Re: Bouncing Balls: Creating a new ball when two balls collide
Programming
Software Development
1 Month Ago
by aishamushtaq
Hi, Its helpful for me. I got my answer.
Re: Nested Class
Programming
Software Development
14 Years Ago
by ddanbe
Nested
classes are intended to be used by the surrounding class and can be made private. A class as such cannot be private. I never have found a really practical use for
nested
classes.
Re: nested this?
Programming
Software Development
13 Years Ago
by mike_2000_17
… are about the OP's question. If you have a
nested
class, then the this pointer, within a call to a… of its wrapper. If you want access to both the
nested
class and the wrapper class, here's the usual trick…(int aValue) : value(aValue) { }; }; int main() { Wrapper A(42); Wrapper::
Nested
B(A); std::cout << "What is the…
nested this?
Programming
Software Development
13 Years Ago
by smcguffee
… class. If I'm inside the
nested
class, does "this" point to the
nested
class or the wrapper class? Likewise…, I suppose I could only do that from inside the
nested
class or else how would it know which instance of…
Re: nested this?
Programming
Software Development
13 Years Ago
by mrnutty
I think you are getting confused. Think of the
Nested
class as a class of its own. The only difference… You can only access it from the outer class. The
nested
class has no association with the parent class, besides the…resolution. What you are doing is creating a instance of
Nested
class in the Wrapper class. Therefore every different instance of…
Re: nested this?
Programming
Software Development
13 Years Ago
by smcguffee
…;<<std::endl; this->nest.foo(); }; class
Nested
{ public: int valueN;
Nested
(int v):valueN(v) { } void foo() { std::cout… inside of on my own? "<<std::endl; }; };
Nested
nest; Wrapper(int aValue) : valueW(aValue),nest(aValue-10) { }; }; int…
nested for
Programming
Software Development
9 Years Ago
by abdul rahman 2
Examples for
nested
for
Nested Tabs
Programming
Web Development
12 Years Ago
by PriyalRao
… clicked on any one of them and show
nested
tabs content related to that link? [CODE]&…another set of tabs <div class="tabs
nested
"> <ul> <li…;a href="#2" class="
nested
">
Nested
Tab 1</a></li>…a href="#2" class="
nested
">
Nested
Tab 2</a></li>…
Nested Select statements
Programming
Databases
15 Years Ago
by 2eXtreme
…was wondering if i were to create the new
nested
select statement from the second code example separately,…dummyVal as avalue from ...) as a on a.idVal =
nested
.idVal left join (select idVal, dummyVal as bvalue from ...)… as b on b.idVal =
nested
.idVal left join (select idVal, dummyVal as cvalue from ...)…
nested loops help
Programming
Software Development
11 Years Ago
by poloblue
…close(); /************************************************************ Part B. Use two
nested
for-loops to process data.txt ************************************************************/… Re-do Part B with two
nested
while-loops *******************************************************************/ sum=counter=max=…
Re: Nested Select statements
Programming
Databases
15 Years Ago
by debasisdas
Why not create views instead of
nested
queries .
Nested Loops and Literal question
Programming
Software Development
14 Years Ago
by beforetheyknew
…just wanted some clarification on two issues.
Nested
Loops, I just want to clarify how… j); } [/CODE] How should i read a
nested
for loop? Like would this run essentially 30 times?…does it basically run once, go into the
nested
loop, run 3 times, then go back into… the outer loop, then back into the
nested
loop 3 times? And I'v read …
Re: Nested Loops and Literal question
Programming
Software Development
14 Years Ago
by darkagn
[QUOTE]How should i read a
nested
for loop? Like would this run essentially 30 times? Does …? So then does it basically run once, go into the
nested
loop, run 3 times, then go back into the outer… loop, then back into the
nested
loop 3 times?[/QUOTE] Yes, the inner code will be…
Re: Nested array printing etc - designing for reuse
Programming
Software Development
7 Years Ago
by JamesCherrill
…java-language-iterating-over-collections-in-java-8.html)). The
nested
arrays stuff is because I was following on from an…noticed that I didn't bother to discuss how the
nested
array walker works. It's a fundamental reason for …using this pattern that it works for all kinds of
nested
structures (flies/directories, XML, trees in general etc). So …
Re: Nested lists help
Programming
Software Development
14 Years Ago
by vegaseat
… """ a recursive function that flattens a
nested
list q """ flat_q = [] for …x in q: # may have
nested
tuples or lists if type(x) in (list, tuple): …(x) return flat_q # itertools.chain won't work on this
nested
list q = [1, [2, 3], [4, 5, 6…
Nested Update
Programming
Databases
13 Years Ago
by PaulNelson
… am having a bit of a problem with implementing a
nested
statement that will update based on conditions. I know the… it, but do not know how to implement it with
nested
queries. Please see below the pseudo code I've written…; aDefinition[/CODE] But I want to do it in a
nested
fashion along the lines of [CODE]UPDATE tmpDifferences ((SET Diff1…
Nested list in Table format will not work
Digital Media
UI / UX Design
13 Years Ago
by nikc121
… figure this out. For some reson my Code for a
nested
list using a table layout will not show the Roman… validated CSS and validated XHTML compliant code to create a
nested
ordered list, with table and inserted image</h2>… validated CSS and validated XHTML compliant code to create a
nested
ordered list, with Divs and inserted image</h2>…
nested for loop and while loop
Programming
Software Development
12 Years Ago
by daldrome
… out a triangle, represented by the "*" in the
nested
for loop. I need to print out a square shape… using "&" symbols but using a
nested
while loop. The target is such that if n=3…;&& &&& I've tried placing the
nested
while loop inside the for loop, but all it does…
Re: Nested Quotes
Community Center
Meta DaniWeb
17 Years Ago
by Dave Sinkula
…it takes a little extra effort. But when it exists,
nested
quotes look a little odd. [post]218686[/post][QUOTE=Dave…it takes a little extra effort. But when it exists,
nested
quotes look a little odd. [post]218686[/post][QUOTE=Dave… it takes a little extra effort. But when it exists,
nested
quotes look a little odd. [post]218686[/post][/QUOTE][/QUOTE…
Re: Nested For Loops
Programming
Software Development
18 Years Ago
by Narue
>Does anybody know the limit of
nested
for loops in C or C++? 15 levels in C89, … more nesting, Python allows non-static nesting where you have
nested
loops, then a function with
nested
loops as the inner operation.
Nested List Searches
Programming
Software Development
17 Years Ago
by sneekula
I was experimenting with the
nested
list example in thread: [URL]http://www.daniweb.com/techtalkforums/…post246791-72.html[/URL] and was trying to search a
nested
list like that: [code]nested_list = [1 ,'Dick', 2, ['Mary', 7…
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC