Thread: flow chart

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    2

    flow chart

    hi
    i am a beginner in c++ so i work on flow charts first now plz help me for this problem
    a ball is dropped from some height and rebounds 5% less than the original height after how many rebounds the ball will come to resr?
    can anybody provide me the flow chart for this program?

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    sounds recursive, what is your current attempt like?

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    It's not recursive, and technically a ball which rebounds 5% less than last time is like Zeno's arrow: It never comes to rest.

    Code:
    int main() {
    	float h = 100.0f;
    	int i = 1;
    	while (h>0.0f) {
    		h -= h*0.05;
    		cout << i++ << ":" << h <<endl;
    	}
    	return 0;
    }
    Last edited by MK27; 04-09-2010 at 06:58 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Flow chart? Haven't used on or created one in years - actually since my high school BASIC class.

    I prefer UML and sequence diagrams to some clunky flow chart.

  5. #5
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by MK27 View Post
    It's not recursive, and technically a ball which rebounds 5% less than last time is like Zeno's arrow: It never comes to rest.
    Theoretically yes, practically no because there are limits to all computer numbers!
    Devoted my life to programming...

  6. #6
    Registered User
    Join Date
    Apr 2010
    Posts
    2

    ball rebouncing problem

    actually my question is
    " ball is dropped from height h i it rebounds 5%less to its previous rebound after how many rebounds the ball will come to rest. "
    in this problem word "rest " is mentioned here so there should b rest in the end

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Okay, perhaps we can alter reality to better suit your assignment.

    Altho, has Cipher says, computer numbers are not infinitely regressive, so eventually you will reach a height which does not change. However, that will not be zero.

    So you need to decide whether a non-zero height can be close enough to "at rest", or what. I guess hovering a billionth of a unit off the ground is more or less at rest.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please help me as fast as possible
    By Xbox999 in forum C Programming
    Replies: 5
    Last Post: 11-30-2009, 06:53 PM
  2. Flow chart genereting tool
    By Kempelen in forum C Programming
    Replies: 1
    Last Post: 06-04-2009, 07:59 AM
  3. Flow Chart
    By strokebow in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2008, 08:57 AM
  4. outputting a ASCII chart
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2002, 11:55 AM
  5. flow chart
    By SPOOK in forum C Programming
    Replies: 0
    Last Post: 10-08-2001, 02:45 PM