10-28-2001, 12:57 PM | #31 | |
Anubis
Join Date: March 1, 2001
Location: Up in the Freedomland Alps
Age: 59
Posts: 2,474
|
Quote:
Mirac, I take it you got all the answers you needed ? If you need more help, you too, just ask. ------------------ The world is my oyster ! |
|
10-28-2001, 05:33 PM | #32 | |
Red Wizard of Thay
Join Date: August 21, 2001
Location: Limburg, Netherlands, Europe
Age: 42
Posts: 894
|
Quote:
------------------ 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-29-2001, 03:42 AM | #33 |
Avatar
Join Date: August 27, 2001
Location: Poznan, Poland
Posts: 575
|
If you cant use arrays then i think it is supposed to be done as a list (or tree). (Because to type over 50 variables would be for sure not intention of any teacher). You say that you didnt have arrays (???), has you pointers?
My pascal skills are dead now, I am working with C from 5 years exclusively, but I think I will propose sth. Btw Lord Shield, your code was more like Basic than Pascal. (Or it was some other strange language?) |
10-29-2001, 05:14 AM | #34 |
Avatar
Join Date: August 27, 2001
Location: Poznan, Poland
Posts: 575
|
OK I modified a little Ertai's code to be able to compile it with very old Borland Pascal 7.0 (but no run-time tests):
(ahh.. that int type I could bet it was in Pascal, but it seems that it has to be Integer ) program Mirac_Honorguard; var list_chars: array ['a'..'z'] of Integer; list_first_apparition: array ['a'..'z'] of Integer; search_char, temp_char, small_char, big_char: char; position, small_times, big_times: Integer; 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 (not(search_char 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 (not (temp_char 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[temp_char]:=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] < 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. |
10-29-2001, 08:06 AM | #35 |
20th Level Warrior
Join Date: September 6, 2001
Location: The lighter side of life, a.k.a. Newnan, Georgia
Age: 55
Posts: 2,767
|
Not to interrupt this fascinating lesson, but I just had to say two things:
One - you are all absolutely amazing!!!! Two - I am SO glad I didn't get into programming afterall!!! *whew* Good luck, Mirac! ------------------ Alureth...Dragon friend of Breanna, Mage and Advisor in the Court of Lady Lioness Co-Owner/Operator of the Evil Petting Zoo and devout member of the HADB clan. Commander of the Dragon Fleet, IW Peacekeeping Force Sublime Sister of the Illuminati - may the Light shine forever! Second Historian and Scribe of IW. Mother Hen of IW. Mage extraordinair, Pin-Up Girl for the OLD-COOTS Magey-Wagey: performer in the Nekked Dancing Trio of the ORT. Hopeless Romantic *sigh* |
10-29-2001, 08:45 AM | #36 |
Symbol of Cyric
Join Date: March 1, 2001
Location: Outside my place
Age: 42
Posts: 1,283
|
Right, its "integer" not "int" . I got confused because now i use Java and C++, i finished learning Pascal last year. Anyway, if mirac says they havent still learned arrays, i doubt they have learned lists or trees. I just think that teacher smoked something
------------------ "Captive, captive... captive in heaven" -Ertai, Captive of the Blinding Angel |
10-29-2001, 10:01 AM | #37 | |
Avatar
Join Date: August 27, 2001
Location: Poznan, Poland
Posts: 575
|
Quote:
I am unable to link and run it now, but if think that condition in while loop should be while ( not (temp_char in (['a'..'z']+'A') )) do ... Zbyszek |
|
10-29-2001, 10:57 AM | #38 |
Symbol of Cyric
Join Date: March 1, 2001
Location: Outside my place
Age: 42
Posts: 1,283
|
SO TRUE !! Sorry about that mistake, its hard to write code without being able to compile or test. Thanks a lot for the warning Zbyszek !!! .
Mirac, let us know when you talk about the problem with your teacher so that we know what kind of structure should you use. ------------------ "Captive, captive... captive in heaven" -Ertai, Captive of the Blinding Angel |
10-31-2001, 06:04 PM | #39 | ||
Red Wizard of Thay
Join Date: August 21, 2001
Location: Limburg, Netherlands, Europe
Age: 42
Posts: 894
|
Quote:
Teacher won't care about that I think. Thanks for your help !!!!!!! ------------------ 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 - Undead Hunter of Keldorn's Order |
||
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 |