| Author | 
		Message | 
	
	
		Yoink Novice
 
   Joined: May 23 2006 Posts: 25 Offline
  | 
		 | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Smong Server Help Squatter
  
   Joined: 1043048991 Posts: 0x91E Offline
  | 
		 | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		CypherJF I gargle nitroglycerin
  
   Gender:  Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
  | 
		
			
			  
			    
				
					 Posted: Sun Oct 08, 2006 2:28 pm     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				if the frame doesn't include a spare or a strike then the total for the frame is that of the 2 throws.
 
 
if the strike occurs on the first throw then it counts as 10 + the next 2 throws.
 
 
if the throw results in a spare then it is 10 + the next throw.
 
 
if on the last frame (10th) if you get a strike 2 you get 2 more throws, if you get a spare you get 1 more and you calculate from there.
 
 
thats if i can recall this correctly.. haven't done manual bowling calculation in years.
 
 
also don't forget about fouls, i think it counts as a miss? _________________ Performance is often the art of cheating carefully. - James Gosling | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Mine GO BOOM Hunch Hunch What What
  
 
  Age:42  Gender:  Joined: Aug 01 2002 Posts: 3615 Location: Las Vegas Offline
  | 
		
			
			  
			    
				
					 Posted: Sun Oct 08, 2006 3:21 pm     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				 	  | Smong wrote: | 	 		  | It also looks like they are teaching you C++, either way I also prefer to use printf and you can use scanf to read input: (as opposed to cin/cout) | 	  
 
He is learning the language. Printf/scanf are horrible ways for him to learn. Yes, I use them much more often (well, printf, scanf almost never), but he doesn't know much about the conventions of programming that it is better to just deal with cin/cout.
 
 
My only recommendation that is different from others is to use loops to read in values from the user. Example:
 
	while (1)
 
{
 
    cout << "Enter value: ";
 
    cin >> value;
 
 
    if ((value > too_small && value < too_big) || value == special_value)
 
        break;
 
 
    cout << "Value is invalid, please try again.\n";
 
}  |   Or:	cout << "Enter value: ";
 
cin >> value;
 
 
while (value < too_small || value > too_big || value != special_value)
 
{
 
    cout << "Value is invalid, please try again.\n";
 
    cout << "Enter value: ";
 
    cin >> value;
 
}  |   
 
This is because invalid userdata could have just been mistyped by accident, and re-entering all previous values because you mistyped one thing is annoying as hell. Only exit a program early if you cannot correct a mistake, such as if a system call failed or you ran out of memory. | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Yoink Novice
 
   Joined: May 23 2006 Posts: 25 Offline
  | 
		
			
			  
			    
				
					 Posted: Sun Oct 08, 2006 7:44 pm     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				 	  | CypherJF wrote: | 	 		  if the frame doesn't include a spare or a strike then the total for the frame is that of the 2 throws.
 
 
if the strike occurs on the first throw then it counts as 10 + the next 2 throws.
 
 
if the throw results in a spare then it is 10 + the next throw.
 
 
if on the last frame (10th) if you get a strike 2 you get 2 more throws, if you get a spare you get 1 more and you calculate from there.
 
 
thats if i can recall this correctly.. haven't done manual bowling calculation in years.
 
 
also don't forget about fouls, i think it counts as a miss? | 	  
 
it's actually simpler - there are no fouls, and it's just a single frame.  
 
 
yes it's c++.
 
 
my prof mentioned something horrendous about using return 1? | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Bak ?ls -s 0 in
  
  Age:26  Gender:  Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
  | 
		
			
			  
			    
				
					 Posted: Sun Oct 08, 2006 10:21 pm     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				the return 0 convention is useful when you're making shell scripts with programs that you make.
 
 
multiple returns inside functions are ugly.
 
 
The System("PAUSE") is because I assume you're using msvc and when you press "debug" to run it the console window pops up and disappears instanty when the program quits. Instead of this, use debug -> start without debugging (ctrl + f5), and it will pause on it's own when the progam terminates so you don't have to sprinkle this throughout your code. In fact, using ctrl + f5 will save, build, and run your code all at once, which is a pretty common sequence so it's worth memorizing.
 
 
Like mgb said you check for an upper bound, but never for a lower bound (if they enter less than zero). _________________ SubSpace Discretion: A Third Generation SubSpace Client | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Cyan~Fire I'll count you!
  
 
  Age:37  Gender:  Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
  | 
		
			
			  
			    
				
					 Posted: Mon Oct 09, 2006 10:23 am     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				You could also just call getchar() (or, I think, cin.get()?) to wait for an enter key before continuing. Make sure you flush the input ahead of time, though, because there may already be characters waiting on the input buffer. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
 
Wise men STILL seek Him. | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Yoink Novice
 
   Joined: May 23 2006 Posts: 25 Offline
  | 
		
			
			  
			    
				
					 Posted: Mon Oct 09, 2006 11:52 am     Post subject:  | 
					  | 
					      | 
				 
			     
			   | 
			 
			
				
  | 
			 
			
				I'm using Bloodshed Dev-C++.
 
 
Anyway, I e-mailed my professor about the return 1; issue and he said it was a huge no-no, so I gotta fix that (pretty sure I know how). | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |