10-27-2001, 04:50 PM | #11 | |
Anubis
Join Date: March 1, 2001
Location: Up in the Freedomland Alps
Age: 59
Posts: 2,474
|
Quote:
------------------ The world is my oyster ! [This message has been edited by Moiraine (edited 10-27-2001).] |
|
10-28-2001, 05:40 AM | #12 | |
Red Wizard of Thay
Join Date: August 21, 2001
Location: Limburg, Netherlands, Europe
Age: 42
Posts: 894
|
Quote:
WOOOOW, I didn't know this was Pascal code. If I sent this to my teacher he'll get suspicious about my capacities. All your help is appreciated and will be used!!!! THANKS!!------------------ Lady Menqel, Protector of IW's, smiter of evil http://www.angelfire.com/rpg2/mirac - Dualled Swashbuckler/Fighter - Fellow Table Dancer of the Jerome's Table dancer group - Spell formulater of the IW peace-keeping force - Thanks to Sazerac for the great sig picture |
|
10-28-2001, 06:04 AM | #13 |
Avatar
Join Date: August 27, 2001
Location: Poznan, Poland
Posts: 575
|
Sorry but like Lord Shield said it was pseudocode, not Pascal code. I havent used Pasal from 5 years.
BUT this is use of if instruction: if (condition_true) then { program_statement; } if (condition_true) then {program_statement;} else {program_statement;} I guess you have also read your data from file or keyboard. In Lord Shield code he assumed that he already has whole sequence in one string. I will repeat - Lord Shield code is pseudocode - do not show it to teacher |
10-28-2001, 07:58 AM | #14 | |
Red Wizard of Thay
Join Date: August 21, 2001
Location: Limburg, Netherlands, Europe
Age: 42
Posts: 894
|
Quote:
Thanks for the advice ------------------ Lady Menqel, Protector of IW's, smiter of evil http://www.angelfire.com/rpg2/mirac - Dualled Swashbuckler/Fighter - Fellow Table Dancer of the Jerome's Table dancer group - Spell formulater of the IW peace-keeping force - Thanks to Sazerac for the great sig picture |
|
10-28-2001, 08:07 AM | #15 |
Symbol of Cyric
Join Date: March 1, 2001
Location: Outside my place
Age: 42
Posts: 1,283
|
Mirac im writing it right now, i think ill finish it in a few minutes and post here. Anyway i dont have TP now, so im writing it in the notepad, maybe it will have some compilation errors but they´ll be easy to fix (for example missing ";" and that kind of things).
------------------ "Captive, captive... captive in heaven" -Ertai, Captive of the Blinding Angel |
10-28-2001, 08:17 AM | #16 |
Symbol of Cyric
Join Date: March 1, 2001
Location: Outside my place
Age: 42
Posts: 1,283
|
Here you are, if you have any question about the code, just ask
program Mirac_Honorguard; var list_chars: array ["a".."z"] of int; list_first_apparition: array ["a".."z"] of int; search_char, temp_char, small_char, big_char: char; position, small_times, big_times: int; begin {initializations} for temp_char:="a" to "z" do begin list_chars[temp_char]:=0; list_first_apparition[temp_char]:=0; end; position=0; small_times=maxint; big_times=0; {we read the character that has to be searched, and we check that its a small letter}; write ("Type the character that has to be searched: "); readln (search_char); while (search_char not in ["a".."z"]) do begin write ("Error ! Type a small letter: "); read (search_char); end; {we start reading the list of characters (and checking them) until we find a "A"} repeat inc (position); write ("Type a small letter: "); readln (temp_char); while (temp_char not in ["a".."z"] do begin write ("Error ! Type a small letter: "); read (temp_char); end; {add 1 to the proper character counter} inc (list_chars[temp_char]); {save position of the first apparition of the character (if its actually the first)} if (list_first_apparition[temp_char]=0) then list_first_apparition:=position; until temp_char="A"; {get the smallest and biggest characters} for temp_char:="a" to "z" do begin if (list_chars[temp_char]>big_times) then begin big_times:=list_chars[temp_char]; big_char:=temp_char; end; if (list_chars[temp_char] -smaller_than small_times) then begin small_times:=list_chars[temp_char]; small_char:=temp_char; end; end; {show the statistics} write ("The search character [", search_char,"] appears ", list_chars[search_char]," times, "); writeln ("first time on position ",list_first_apparition[search_char],"."); write ("The smallest character [", small_char,"] appears ", list_chars[small_char]," times, "); writeln ("first time on position ",list_first_apparition[small_char],"."); write ("The biggest character [", big_char,"] appears ", list_chars[big_char]," times, "); writeln ("first time on position ",list_first_apparition[big_char],"."); end. ------------------ "Captive, captive... captive in heaven" -Ertai, Captive of the Blinding Angel [This message has been edited by Ertai_OHF (edited 10-28-2001).] |
10-28-2001, 08:20 AM | #17 |
Dracolisk
Join Date: January 8, 2001
Location: Amsterdam, The Netherlands
Age: 43
Posts: 6,541
|
*slinks away quietly, baffled* ------------------ Melusine, Sultry Elflet, High Queen of Fluffies, Archbabe of the OHF, LH, HADB and ORT! Your voice is ambrosia Amy Brown Fantasy Art |
10-28-2001, 08:25 AM | #18 |
Symbol of Cyric
Join Date: March 1, 2001
Location: Outside my place
Age: 42
Posts: 1,283
|
Where it says -smaller_than, it should be the "smaller than" symbol (the opposite of ">"), but i couldnt type it here coz the board treats it like a HTML tag and it messes the whole text).
------------------ "Captive, captive... captive in heaven" -Ertai, Captive of the Blinding Angel |
10-28-2001, 09:28 AM | #19 | |
Ma'at - Goddess of Truth & Justice
Join Date: January 7, 2001
Location: I live inside of my mind.....
Age: 53
Posts: 3,234
|
Quote:
don't worry you're not alone with that feeling.. I got a 'D' at C++ class over a year ago decided that programming is not my field *shot a glare at one of the brothers* to be quite frank I get more education from the folks on the 'net rather in the class at campus ------------------ Realm of Warlock's Art The Host of Sigs - who's your daddy now? I bow to Ziroc the grand master! I shall never mock Choc again! |
|
10-28-2001, 10:36 AM | #20 | |
Guest
Posts: n/a
|
Quote:
yeh, it's annoying it leaves out indented spaces in code too - makes it more readable ------------------ Lord Raptor's Site Ironworks Dark General BG2 Tavern Keeper King of Pointlessness |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
C++ programming/coding/editing | SilentThief | General Conversation Archives (11/2000 - 01/2005) | 4 | 01-24-2005 02:24 PM |
The Future of Programming -- ROFL! | VulcanRider | General Conversation Archives (11/2000 - 01/2005) | 2 | 07-31-2003 07:28 PM |
Programming... | SirTristram | General Conversation Archives (11/2000 - 01/2005) | 13 | 11-22-2002 07:11 PM |
Programming | T/-/alali | General Conversation Archives (11/2000 - 01/2005) | 4 | 09-12-2002 04:05 PM |
Malicious programming! | Sir Kenyth | General Conversation Archives (11/2000 - 01/2005) | 8 | 07-04-2002 12:40 AM |