Pascal help! ASAP

Wd My passport essential se portable 1tb...
October 9, 2010 at 01:59:07
Specs: Windows XP
Hello!

I have this assignement in pascal where I have to make it know my gender by the ending of my name. for example, if my name ends with a or e I am a female and if it ends with other letters, i am a male.
is there any way how I could do this?


See More: Pascal help! ASAP

Report •

#1
October 9, 2010 at 02:07:13
Start with pseudo-code.

Display usage
get input
parse string
compare
...
...


=====================================
Helping others achieve escape felicity

M2


Report •

#2
October 9, 2010 at 02:14:00
thanks!
I am a total beginner in all this pascal thing.
is that what i am supposed to write in pascal or are there some other codes?

Report •

#3
October 9, 2010 at 02:17:33
http://en.wikipedia.org/wiki/Pseudo...


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
October 9, 2010 at 09:48:45
Mechanix2Go correctly suggests you start by writing Pseudo Code i.e. an outline of your source code not bound to any programming language then convert it to working Pascal code. This is the usual lane to follow for a beginner, much like to draw a flow chart diagram in graphic way.

By the way to code Pascal source a quick sight about your compiler is needed and about your location too since...

MariA is female, SarA is female, MirellE is female, but what about DeboraH, JennifeR or MiriaM?


Report •

#5
October 11, 2010 at 09:46:58
I'm from Latvia and and we only have female names ending with a and e. Other endings are for male names.

The main task is to write 10 questions that pascal will ask me and I will have to answer them (also the yes/no choices, case of and if). I already have done everything else except this gender thing.
Now I have the length code ready and working (that code which says how long is the exact wod). Now I just need to understand the things with andings. When that will be done I will have to ask a question according to gender, but I have almost figured that part out.


Report •

#6
October 11, 2010 at 13:23:43
Here a sample in Borland Pascal. If you prefer to compute the Name length by your own instead of using the Length built-in function do it.

Program Latvia;

var
  L_Name: integer;
  Name, Gender:  string;

Begin
  WriteLn; Write ('  Enter name> '); ReadLn (Name);

  L_Name:= Length(Name);

  case Name[L_Name] of
    'A', 'a': Gender:= 'female';
    'E', 'e': Gender:= 'female';
  else
    Gender:= 'male';
  end;
  WriteLn (Gender);
End.


Report •

#7
October 12, 2010 at 08:17:40
Thank you SOOOOOOOO MUCH! everything is on and working. :)

Report •

Ask Question