Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

comparison

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heres a new code: how do i fix the end to say the following:

First Person: Smith, John (31)
Second Person: Doe, Mike (35)
Doe is older than Smith

and have it where three different things can happen i.e. doe older that smith, smith older than doe, or the same age.

 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code works perfectly, once you remove all the silly mistakes.

I feel like you can figure them out on your own. but a few hints:

if(boolean)
do stuff;

is an if statement. you have

if(boolean) =
do stuff;

that equals sign doesn't make sense

next: end every statement with a ;. you may not end a string with +.

Variable names must be unique. you can't have both a string and an int with user1age.

what is 'choice'? if I'm the computer, how do I recognize 'choice'?

final note:
put some time into debugging your code before you ask someone else to fix it.
[ September 11, 2004: Message edited by: Joseph George ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like to program in tiny little baby steps. I write one line of code and then check to see if it compiles. (I use a fancy IDE that checks syntax continuously as I type.) This way, whenever I do have a compiler error, I have a pretty good idea of exactly where it is, and it's usually pretty easy to recognize the mistake quickly.

I've run into quite a few very new programmers that had the habit of writing dozens of lines of code before seeing what the compiler had to say about what things. These folks also seemed to have problems figuring out fixing the dizzying web of errors they'd often face.
[ September 11, 2004: Message edited by: Dirk Schreckmann ]
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
appologies for a perhaps over brusque response.
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic