I've hit a brick wall with a program I'm planning to write.

I've hit a brick wall with a program I'm planning to write.
it's one where you enter a date and month, and from there, can calculate what your starsign is.  TDate doesn't work because I can't figure out how to get the input as a month/date (mm.dd) without the overloading errors.
I'm trying to do the this with array of different types, and that doesn't work either.

and apparently, neither does case..of.

program cancer_calc;

{$APPTYPE CONSOLE}


type
  TMonths = (Jun,Jul);
  TDays = 1..31;
var
  dd : TDays;
  month : TMonths;
begin
  readln(month);
  readln(dd);
  writeln(month, '.', dd);
  case month of
    Jun, 23..30,Jul, 1..22:
    write('your starsign is not cancer.');
  else
  writeln('your starsign is cancer.');
  readln;
  end;
end.

Comments

  1. I got it to work. I ended up using variables like mm (1-12) for months, and dd(1-30) for days.
    and  
    for whatever reason, anytime I tried to use something like var: (jan, feb, mar...etc), I'd constantly get a 'illegal type in read' error.
    even though it's a variable. apparently I can't use strings as anything if I wish to read from them.

    ReplyDelete
  2. Paiseley Tobin that's what most suggestions tried to tell. Glad you were persistent and kept trying. That's the way to learn. Good work!

    ReplyDelete
  3. thanks to everyone for your suggestions.

    ReplyDelete

Post a Comment