Pascal Help

Discuss all aspects of programming here.

Moderator: The Mod Squad

Pascal Help

Postby HeZzA » Sun Sep 05, 2004 9:54 pm

Hi, i was wondering if anyone can tell me how to change a font color in pascal, i have created a calculator program to calculate how long my bit torrent downloads have left (going at a certain speed) since i have found the eta field to usually be way off, it all works and all but i cant figure out how to change the colors of the fonts to pretty it up.

This is my code

program calculator;

var per, perl, avs, sizemb, sizekb, etasec, etamin, etahour, etaday, mbleft, kbleft : real;

begin;
writeln('This Program will calculate the approximate time for a download');
writeln('Enter the percentage that has been downloaded : ');
read(per);
perl := 100 - per;
while per < 0 and per > 100 do
begin
writeln('This is not a valid percentage');
writeln('Enter the percentage that has been downloaded : ');
read(per)
perl := 100 - per;
end;
writeln('Now enter the total size (in MB) of the file : ');
readln(sizemb);
sizekb := sizemb * 1000;
mbleft := sizemb / 100 * perl;
kbleft := mbleft * 1000;
writeln('Enter the average speed (in KB/s) to calculate for : ');
read(avs);
etasec := kbleft / avs;
etamin := etasec / 60;
etahour := etamin / 60;
etaday := etahour / 24;
if etasec < 60
then writeln('There is only ', etasec:3:1, 'seconds left of this download')
else writeln('There is ', etamin:3:1, ' Minutes left for this download');
if etamin > 60
then writeln('Which is ', etahour:3:1, ' hours left for this download')
else write;
if etahour > 24
then writeln('(', etaday:3:1, ' Day(s) left for the download)')
else write;
readln;
readln;
end.


I want to change the color of
writeln('There is only ', etasec:3:1, 'seconds left of this download')
writeln('There is ', etamin:3:1, ' Minutes left for this download');
then writeln('Which is ', etahour:3:1, ' hours left for this download')

and
writeln('(', etaday:3:1, ' Day(s) left for the download)')

Can Anyone help me?
HeZzA
P4 3.0 Northwood
2x 512mb ddr400 Corshair (running in dual)
GA-8KNXP
Seagate 120Gb Sata
WD 200Gb Sata
9800 Pro
DVD ROM R/RW
new: Polo735 w/ Atric Silver :) took idle temp down 12 degrees!!!
HeZzA
Pilgrim
Pilgrim
 
Posts: 5
Joined: Sat Jul 24, 2004 3:06 am

Postby dve83 » Wed Sep 08, 2004 6:43 am

hi sorry i might have missed something here (hope not though),

to change the color of your output to the screen
I think setColor should be used just before you writeln anything to screen.

eg.

SetColor(5);

end eg.

use any number from 1-16 or (i think)u can specify it like "blue" or " white"

cheers good luck-
-dve83- Folding for 33258
Gigabyte GA-MA69VM-S2,AMD Athlon X2 5200+, 6GB DDR2-800, Seagate 250GB 7200 RPM, Western Digital 1TB 7200RPM,
460W Coolermaster PSU, Windows 7

"Perhaps it's not paranoia. Perhaps it's just finesse." - dve83
dve83
Black Belt
Black Belt
 
Posts: 615
Joined: Sun Jun 29, 2003 3:58 pm
Location: South Africa, Cape Town

Postby Hardware Junkie » Wed Sep 08, 2004 5:19 pm

"Imagination is the only weapon in the war against reality." -Jules de Gautier

Image
Hardware Junkie
Mobo-fu Master
Mobo-fu Master
 
Posts: 19405
Joined: Thu Jan 25, 2001 1:01 am
Location: 00000h - 0000Fh

Postby dve83 » Fri Sep 10, 2004 1:23 am

yeah thats right @ that link. sorry my mistake.
-dve83- Folding for 33258
Gigabyte GA-MA69VM-S2,AMD Athlon X2 5200+, 6GB DDR2-800, Seagate 250GB 7200 RPM, Western Digital 1TB 7200RPM,
460W Coolermaster PSU, Windows 7

"Perhaps it's not paranoia. Perhaps it's just finesse." - dve83
dve83
Black Belt
Black Belt
 
Posts: 615
Joined: Sun Jun 29, 2003 3:58 pm
Location: South Africa, Cape Town

Postby kltsin » Fri Sep 10, 2004 7:45 am

I know this is a programming forum and hate to bring up the obvious but.... I have nothing better to do. :D

Bit torrent requires a give and take method for this p2p client.
I am sure you are aware of this.

The algorithems alone to "predict" when a torrent file is finished is astounding and uncomprehensible.

Have you checked out the other bit torrent clients?

If you have you can see the client can be manipulated and each version of the client will affect the end user and the person he is drawing files from.
More so you are dealing with peoples whims and that is trouble.

Well best of luck and I would love to see the outcome.
kltsin
Black Belt 2nd Degree
Black Belt 2nd Degree
 
Posts: 2792
Joined: Tue Jun 29, 2004 9:05 am
Location: St. Augustine, Fl


Return to Programming

Who is online

Users browsing this forum: Omgili [Bot] and 0 guests

cron