Βοηθειααα pascal,εχω ενα πρβλημα με την pascal θελψ να εισαγω types kai records

Συζητήσεις σχετικές με την Delphi και την πρόγονη της Pascal

Συντονιστές: WebDev Moderators, Super-Moderators

Απάντηση
tasos1314
Δημοσιεύσεις: 1
Εγγραφή: 01 Φεβ 2016 00:15

Βοηθειααα pascal,εχω ενα πρβλημα με την pascal θελψ να εισαγω types kai records

Δημοσίευση από tasos1314 » 01 Φεβ 2016 00:25

Κώδικας: Επιλογή όλων

program spectre;
Uses Crt;
var a, b, x, weapon:integer;
selection, direction : char;
raceName, className, myName : String;
strength, intelligence, agility, location : integer;
weapons:array[1..5] of string;

begin
TextColor (lightred);

writeln ('welcome to my game');
writeln (' ___  ____  ____  ___  ____  ____  ____ ');
writeln ('/ __)(  _ \( ___)/ __)(_  _)(  _ \( ___)');
writeln ('\__ \ )___/ )__)( (__   )(   )   / )__) ');
writeln ('(___/(__)  (____)\___) (__) (_)\_)(____)');
writeln();
writeln ('Please, what is your name oh great one!?');
readln(myName);
writeln('Welcome oh magestic ', myName);
writeln ('------------------------');

repeat

	writeln ('(1) human');
	writeln ('(2) orc');
	writeln ('(3) undead');
	writeln ('(4) elf');
	writeln(); 
	writeln ('please choose your race');
	read (a);
	writeln();
until &#40;a>=1&#41; and &#40;a<=4&#41;;

  
  case &#40;a&#41; of 
  	1&#58;begin
  		writeln &#40;'you choose to be a Human'&#41;;
  		raceName&#58;='Human';
  		strength&#58;= 20;
  		intelligence &#58;=15; 
  		agility &#58;= 15;
  	  end;
  	2&#58;begin
  		writeln &#40;'you choose to be an orc'&#41;;
  		raceName&#58;='Orc';
  		strength&#58;= 40;
  		intelligence &#58;=0; 
  		agility &#58;= 10;
  	  end;
  	3&#58;begin
  		writeln &#40;'you choose to be an undead'&#41;;
  		raceName&#58;='Undead';
  		strength&#58;= 10;
  		intelligence &#58;=20; 
  		agility &#58;= 20;
  	  end;
  	4&#58;begin
  		writeln &#40;'you choose to be an elf'&#41;;
  		raceName&#58;='Elf';
  		strength&#58;= 10;
  		intelligence &#58;=40; 
  		agility &#58;= 0;
  	  end;
  end;
  
    writeln&#40;&#41;; 

repeat
	writeln &#40;'&#40;1&#41; mage'&#41;;
	writeln &#40;'&#40;2&#41;warrior'&#41;;
	writeln &#40;'&#40;3&#41;priest'&#41;;
	writeln&#40;'&#40;4&#41; archer'&#41;;
	writeln&#40;&#41;;
	writeln &#40;'please select your class'&#41;;
	read&#40;b&#41;;
	writeln&#40;&#41;;
until &#40;b>=1&#41; and &#40;b<=4&#41;;


 case &#40;b&#41; of
  	1&#58;begin
  		writeln &#40;'you choose to be a mage'&#41;;
  		className&#58;='Mage';
  		strength&#58;= strength + 35;
  		intelligence &#58;= intelligence + 0; 
  		agility &#58;= agility + 15;
  	  end;
  	2&#58;begin
  		writeln &#40;'you choose to be a warrior'&#41;;
  		className&#58;='Warrior';
  		strength&#58;= strength + 0;
  		intelligence &#58;= intelligence + 50; 
  		agility &#58;= agility + 0;
  	  end;
  	3&#58;begin
  		writeln &#40;'you choose to be a priest'&#41;;
  		className&#58;='Priest';
  		strength&#58;= strength + 10;
  		intelligence &#58;= intelligence + 0; 
  		agility &#58;= agility + 40;
  	  end;
  	4&#58;begin
  		writeln &#40;'you choose to be an archer'&#41;;
  		className&#58;='Archer';
  		strength&#58;= strength + 10;
  		intelligence &#58;= intelligence + 40; 
  		agility &#58;= agility + 0;
  	  end;
  
  end;

repeat
    weapons&#91;1&#93;&#58;= 'Scepter';
    weapons&#91;2&#93;&#58;= 'Longsword';
    weapons&#91;3&#93;&#58;= 'staff';
    weapons&#91;4&#93;&#58;= 'bow';
    writeln&#40;'------------------------------'&#41;;
    writeln&#40;'Please choose your weapon!!! '&#41;;
    for x&#58;=1 to 4 do
    	writeln&#40;weapons&#91;x&#93;&#41;;
    
    read&#40;weapon&#41;;
until &#40;weapon<=4&#41; and &#40;weapon>=1&#41;;
writeln&#40;&#41;;
writeln&#40;'Your weapon is,', weapons&#91;weapon&#93;&#41;;

 
 

 
 
 
 
 
 writeln&#40;&#41;;
  
 
  
  
 
  writeln&#40;'--------------------------------'&#41;;
  write&#40;'Thank you very much amazing ', raceName, ' ', className, '!!!'&#41;;
  write&#40;'Your Stats are&#58; Strength&#58; ', strength, ' Intelligence&#58; ', intelligence, ' Agility&#58; ', agility, 'Your weapon is&#58;', weapons&#91;weapon&#93;, '!'&#41;;
  
  
  
  
  writeln &#40;&#41;;
  readln&#40;&#41;; // must be here!
  writeln&#40;'-----------------------------'&#41;;
  &#123;repeat
  	writeln &#40;'Where you want me to go?'&#41;;
  	readln&#40;selection&#41;;
  until &#40;selection='N'&#41; or &#40;selection='W'&#41; or &#40;selection='S'&#41; or &#40;selection='E'&#41;;
  
  if &#40;selection = 'N'&#41; then 
   begin
  		writeln &#40;'you are in a cave'&#41;;
  	end
  else if &#40;selection = 'W'&#41; then
  begin
  		writeln &#40;'you are in a lake'&#41;;
  	end
  else if &#40;selection = 'S'&#41; then
  begin
  		writeln &#40;'you are in a forest'&#41;;
  	end
  else if &#40;selection = 'E'&#41; then 
    begin
  		writeln &#40;'you are in a village'&#41;;
   end;
  
        writeln&#40;&#41;;&#125;
        
        location&#58;=0;

//readln&#40;&#41;;
repeat
 case&#40;location&#41; of
  0&#58;
    begin
     writeln&#40;'You are in the SUMMONER RIFT '&#41;;
     writeln&#40;'Choose your next step'&#41;;
     writeln&#40;'For moving North press&#40;n&#41;'&#41;;
     writeln&#40;'For moving South press&#40;s&#41;'&#41;;
     writeln&#40;'For moving East press&#40;e&#41;'&#41;;
     writeln&#40;'For moving West press&#40;w&#41;'&#41;;
     readln&#40;direction&#41;;
      case&#40;direction&#41; of
       'n'&#58;
           begin
            location&#58;=1;
           end;
       'e'&#58;
           begin
            location&#58;=2;
           end;
       's'&#58;
           begin
            location&#58;=3;
           end;
       'w'&#58;
           begin
            location&#58;=4;
           end;
       end;
     end;
         
 1&#58; 
   begin
         writeln&#40;'You moving to the forest'&#41;;
         writeln&#40;'went south. You are in a junction'&#41;;
         writeln&#40;'For moving South press&#40;s&#41;'&#41;;
         readln&#40;direction&#41;;
        case&#40;direction&#41; of
        's'&#58;
          begin
          location&#58;=0;
          end;
          end;
          end;
 2&#58; 
   begin
         writeln&#40;'You are entering a lake '&#41;;
         writeln&#40;'went west. You are in a junction'&#41;;
         writeln&#40;'For moving West press&#40;w&#41;'&#41;;
         readln&#40;direction&#41;; 
         case&#40;direction&#41; of
         'w'&#58;
            begin
            location&#58;=0;
           end;
           end;
           end; 
 3&#58; 
   begin
         writeln&#40;'You enter to a cave '&#41;;
         writeln&#40;'You went north. You are in a junction'&#41;;
         writeln&#40;'For moving North press&#40;n&#41;'&#41;;
         readln&#40;direction&#41;;
         case&#40;direction&#41; of
         'n'&#58;
          begin
          location&#58;=0;
          end;
          end;
          end;
 4&#58; 
   begin
        writeln&#40;'You are entering the village'&#41;;
        writeln&#40;'You went east. You are in a junction'&#41;;
        writeln&#40;'For moving East press&#40;e&#41;'&#41;;
        readln&#40;direction&#41;;
        case&#40;direction&#41; of
        'e'&#58;
           begin
         location&#58;=0;
         end;
         end;
         end;
end;
until&#40;direction='a'&#41;;













end.

Άβαταρ μέλους
tech_junky
Δημοσιεύσεις: 14
Εγγραφή: 31 Μαρ 2011 00:12
Τοποθεσία: Πειραιας

Βοηθειααα pascal,εχω ενα πρβλημα με την pascal θελψ να εισαγω types kai records

Δημοσίευση από tech_junky » 08 Φεβ 2016 20:29

Αυτό είναι console application.
Τι αλλαγή θέλεις να κάνεις?

Απάντηση

Επιστροφή στο “Delphi, Pascal”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες