# little help please

Hi every one
I have a project about a calendar and I need a little help
I want the program to ask me about the day ,the month and the year and display the monthes in 3 raws and 4 columns.please reply me as soon as possible guys

## Comments

• : Hi every one
: I have a project about a calendar and I need a little help
: I want the program to ask me about the day ,the month and the year
: and display the monthes in 3 raws and 4 columns.please reply me as
: soon as possible guys
:
:
Hi, here's my idea:
1. Get an early date like: 1980.Jan.1
2. Look it up what day it was ( Tue. in this case )
3. Calculate how many days passed since that day ( taking count the leap
years ) to Jan.1 of current year
4. Mod the result by 7 ( 0 will be Tue. in this case, 1=Wed ...and so on )
to find out what day is Jan.1 of current year.
5. Now all you need to do is to display the months the way you want to,
cycling through the days as you go, highlight the current day when you
get to it.

Cheers
• : : Hi every one
: : I have a project about a calendar and I need a little help
: : I want the program to ask me about the day ,the month and the year
: : and display the monthes in 3 raws and 4 columns.please reply me as
: : soon as possible guys
: :
: :
: Hi, here's my idea:
: 1. Get an early date like: 1980.Jan.1
: 2. Look it up what day it was ( Tue. in this case )
: 3. Calculate how many days passed since that day ( taking count the
: leap
: years ) to Jan.1 of current year
: 4. Mod the result by 7 ( 0 will be Tue. in this case, 1=Wed ...and
: so on )
: to find out what day is Jan.1 of current year.
: 5. Now all you need to do is to display the months the way you want
: to,
: cycling through the days as you go, highlight the current day
: when you
: get to it.
:
: Cheers
:
how to arrange the calender into

jan feb march
april may june
july august september
october november desember

without using graphics
• : :
: how to arrange the calender into
:
: jan feb march
: april may june
: july august september
: october november desember
:
: without using graphics
:

Use crt unit's gotoxy command to move cursor around or you can write direcly into the video memory. This command will work like putpixel except places characters, will print everything not like "write" and leaves the cursor where is it.

procedure mem_write(x,y:byte;ch:char);
{x=[1..80], y=[1..25], ch = any character }
begin
mem[\$b800:(y-1)*160+(x-1)*2]:=ord(ch);
end;
• : : : Hi every one
: : : I have a project about a calendar and I need a little help
: : : I want the program to ask me about the day ,the month and the year
: : : and display the monthes in 3 raws and 4 columns.please reply me as
: : : soon as possible guys
: : :
: :
: how to arrange the calender into
:
: jan feb march
: april may june
: july august september
: october november desember
:
: without using graphics
:
Use the [b]Window[/b] procedure that is part of the CRT unit. You should be able to create a separate window for each month, each 25 columns wide and 6 rows high. The problem should then reduce to one of writing one calendar routine which could then be repeated in each window.

• : how to arrange the calender into
:
: jan feb march
: april may june
: july august september
: october november desember
:
: without using graphics
:
[code]
Program Calendar ;

Uses
Crt ;

Type
MonthType = (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) ;

CONST
MONTHS : Array [Jan .. Dec] of String[9] = ('JANUARY',
'FEBRUARY',
'MARCH',
'APRIL',
'MAY',
'JUNE',
'JULY',
'AUGUST',
'SEPTEMBER',
'OCTOBER',
'NOVEMBER',
'DECEMBER') ;

WINWIDE = 23 ;
WINHIGH = 6 ;
LEFT : Array [Jan .. Dec] of Byte = (1, WINWIDE + 2, 2*WINWIDE + 4,
1, WINWIDE + 2, 2*WINWIDE + 4,
1, WINWIDE + 2, 2*WINWIDE + 4,
1, WINWIDE + 2, 2*WINWIDE + 4) ;
RIGHT : Array [Jan .. Dec] of Byte = (WINWIDE, 2*WINWIDE + 2, 3*WINWIDE + 4,
WINWIDE, 2*WINWIDE + 2, 3*WINWIDE + 4,
WINWIDE, 2*WINWIDE + 2, 3*WINWIDE + 4,
WINWIDE, 2*WINWIDE + 2, 3*WINWIDE + 4) ;
TOP : Array [Jan .. Dec] of Byte = (1, 1, 1,
WINHIGH + 1, WINHIGH + 1, WINHIGH + 1,
2*WINHIGH + 1, 2*WINHIGH + 1 , 2*WINHIGH + 1,
3*WINHIGH + 1, 3*WINHIGH + 1 , 3*WINHIGH + 1) ;
BOTTOM: Array [Jan .. Dec] of Byte = (WINHIGH, WINHIGH, WINHIGH,
2*WINHIGH, 2*WINHIGH, 2*WINHIGH,
3*WINHIGH, 3*WINHIGH, 3*WINHIGH,
4*WINHIGH, 4*WINHIGH, 4*WINHIGH) ;

Procedure Show (Mon : MonthType) ;

begin { Show }
Window (LEFT[Mon], TOP[Mon], RIGHT[Mon], BOTTOM[Mon]) ;
if Ord(Mon) MOD 2 = 0 then
TextBackground(RED)
else
TextBackground(BLUE) ;
ClrScr ;
WriteLn (Months[Mon]:WINWIDE - 2)
end ; { Show }

Var
Mon : MonthType ;
i : 1 .. 4 ;

begin { Calendar }
TextBackground(BLACK) ;
ClrScr ;
for Mon := Jan to Dec do
Show(Mon) ;
ReadLn
end. { Calendar }
[/code]
• Can anyone write me the full code of my program please
• where is everybody??
come on guys.
• : where is everybody??
: come on guys.
:
With the info given, you should have no problem writing your project. Start coding and I'll help you if you get stuck...
• : where is everybody??
: come on guys.
:
[code]
uses crt;
label redoStartingPoint,redoMonth;
var totalDays,moveTo,I,line,startsOn,year,inMonth:integer;
leapYear:boolean;
monthName:string;
begin
clrscr;
writeln('What year are you in?');
readln(year);
if(year mod 4 = 0) and not((year mod 100 = 0) and (year mod 400 = 0)) then
leapYear:=true
else
leapYear:=false;
redoMonth:clrscr;
writeln('What month are you currently in?');
writeln('1.':5,'January');
writeln('2.':5,'February');
writeln('3.':5,'March');
writeln('4.':5,'April');
writeln('5.':5,'May');
writeln('6.':5,'June');
writeln('7.':5,'July');
writeln('8.':5,'August');
writeln('9.':5,'September');
writeln('10.':5,'October');
writeln('11.':5,'Novermber');
writeln('12.':5,'December');
readln(inMonth);
case inMonth of
1:begin monthName:='January'; totalDays:=30; end;
2:begin monthName:='February'; totalDays:=28; end;
3:begin monthName:='March'; totalDays:=31; end;
4:begin monthName:='April'; totalDays:=30; end;
5:begin monthName:='May'; totalDays:=31; end;
6:begin monthName:='June'; totalDays:=30; end;
7:begin monthName:='July'; totalDays:=31; end;
8:begin monthName:='August'; totalDays:=31; end;
9:begin monthName:='September'; totalDays:=30; end;
10:begin monthName:='October'; totalDays:=31; end;
11:begin monthName:='November'; totalDays:=30; end;
12:begin monthName:='December'; totalDays:=31; end;
else
clrscr;
writeln('Please enter the number of the month');
delay(2000);
goto redoMonth;
end;
if(inMonth=2) and (leapYear=true) then
totalDays:=succ(totalDays);
redoStartingPoint:clrscr;
writeln('On what day does this month start?');
writeln('1.':5,'Sunday'); {use the width thing to nicley indent and align the options}
writeln('2.':5,'Monay');
writeln('3.':5,'Tuesday');
writeln('4.':5,'Wednesday');
writeln('5.':5,'Thursday');
writeln('6.':5,'Friday');
writeln('7.':5,'Saturday');
readln(startsOn);
if (startsOn < 1) OR (startsOn > 7) then
begin {if the user enters a number not between 1 and 7 ask them to re-enter the number}
clrscr;
writeln('Please enter the number of the day');
delay(2000); {pause for 2 secs again so the user can read the error, instructions}
goto redoStartingPoint;
end;
clrscr;
line:=3;
{output the days of the week nicley in the center}
gotoxy((80-length(monthName)-7) div 2,1);
writeln(year:4,' - ',monthName);
writeln(' Sunday Monday Tuesday Wednesday Thursday Friday Saturday ');
writeln;
for I:=1 to totalDays do
begin
case startsOn of
1:moveTo:=9; {set the x-coordinate depending on the day of the week}
2:moveTo:=19;
3:moveTo:=30;
4:moveTo:=43;
5:moveTo:=55;
6:moveTo:=65;
7:moveTo:=77;
end;
if I > 9 then
moveTo:=pred(moveTo); {if the date is a 2 digit decrease the x-coordinate by one}
gotoxy(moveTo,line);
write(I);
startsOn:=succ(startsOn);
if startsOn > 7 then
begin
startsOn:=1; {end of the week? go back to the begining}
line:=succ(line); {the end of the week? increase the y-coordinate by 1}
end;
end;
readln;
end.[/code]

Here try to change this code abit around
• : where is everybody??
: come on guys.
:
Tinker with this:

[color=Blue][code]
program calendar;

const _day_:array[0..6] of string[9]=
('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');
_month_:array[1..12] of string[9]=('January','February','March',
'April','May','June','July',
'August','September','October',
'November','December');
_dinm_:array[1..12] of byte=(31,28,31,30,31,30,31,31,30,31,30,31);
_tattr_:byte=\$07; {same as crt unit's textattr}
on:byte=0;
off:byte=1;

var year:word;
month,day,dofw:byte;
i,j,px,py:byte;

procedure cls;assembler; {Fast clear screen in text mode}
asm
mov ah,0fh
int 10h
xor ah,ah
int 10h
end;

procedure get_date;assembler;
asm
mov ah,2ah
int 21h
mov year,cx
mov month,dh
mov day,dl
mov dofw,al
end;

procedure outchar(x,y,attr:byte;ch_:char);assembler;
{Prints a character @ x,y | y[1..25], x[1..80], ch: any char, attr: text attribute}
asm
mov al, x
cmp al, 1
jl @1
cmp al, 80
jg @1
mov al, y
cmp al, 1
jl @1
cmp al, 25
jg @1
mov ax, \$b800
mov es, ax
xor bh, bh
mov bl, x
dec bx
shl bx, 1
mov di, bx
xor dh, dh
mov dl, y
dec dx
mov bx, dx
shl dx, 7
shl bx, 5
add dx, bx
add di, dx
mov al, ch_
mov ah, attr
stosw
@1:{does nothing if coords are out of range}
end;

procedure hi_intensity(status:word);assembler;
asm
mov ax,\$1003
mov bx,status
int 10h
end;

procedure writeat(x,y:byte;s:string);
var i:byte;
begin
for i:=1 to ord(s[0]) do outchar(pred(x+i),y,_tattr_,s[i]);
end;

function get_day_of_the_week(y{ear},m{onth},d{ay}:integer):integer;
{Returns the day of the week: 0=Sun, 1=Mon.. 6=Sat using the
Zeller's congruency algorithm}
var c{entury},t{emp}:integer;
begin
if (y<0) or not(m in[1..12]) or not(d in[1..31]) then
get_day_of_the_week:=-1 {Flag incorrect input} else
begin
c:=y div 100;
y:=y mod 100;
if m<3 then begin
inc(m,12);
if y>0 then dec(y)
else begin
y:=99;
dec(c);
end;
end;
t:=d;
t:=t+(((m+1)*26) div 10);
inc(t,y);
t:=t+(y div 4);
t:=t+(c div 4);
t:=t-c-c;
while t<0 do inc(t,7);
t:=t mod 7;
if t=0 then t:=7;
dec(t);
get_day_of_the_week:=t;
end;
end;

function is_leap_year(y:word):boolean;
begin
is_leap_year:=(y mod 4=0) and not((y mod 100=0) and (y mod 400<>0));
end;

function tostr(value:word):string;
var s:string;
begin
str(value,s);
tostr:=s;
end;

function right_pad(s:string;len:byte):string;
begin
while ord(s[0])');
j:=get_day_of_the_week(year,1,1);
px:=1;
py:=2;
for i:=1 to 12 do begin
j:=display_month(px,py,i,j);
if px>=61 then begin
px:=1;
inc(py,8);
end else inc(px,20);
end;
asm
xor ax,ax
int 16h
end;
hi_intensity(off);
cls;
end.
[/code][/color]
• All of them didn't work

please help me before christmas because I have to give it in 10 days
• : All of them didn't work
:
: please help me before christmas because I have to give it in 10 days
:
They all working for me... what compiler are you using ? Describe what's happening
• : Can anyone write me the full code of my program please
:

I think they are trying to say; do your own homework first, then when you have a specific problem, ask with code examples.

If you get what you want,"...write me the full code of my program ..." then you will not learn how.

If you don't learn how, then you will get a job that you can't do, that you passed a class for
Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!