Ερώτηση για readln...

Ξεκίνησε από Ma8hths, 19 Φεβ 2011, 07:34:59 ΜΜ

« προηγούμενο - επόμενο »

Ma8hths

Καλησπέρα,και συχαρητήρια για το  forum σας.
Θα ήθελα να ρωτήσω στην Pascal  πως γίνετε να εισάγω στο πρόγραμμα π.χ. μια IP address δηλαδή: 192.168.5.1.Μετά θέλω να επεξεργάζομαι ξεχωριστά κάθε αριθμό.Και τέλος να το εμφανίζω σε διάδικοι μορφή με τέλειες  δηλαδή: 11000000.10101000.00000101.00000001.Γινετε;

gthal

Γεια σου φίλε μου.
Αν κατάλαβα σωστά την ερώτηση, υποθέτω ότι θα πρέπει να τη διαβάσεις σαν String,
να την "κόψεις" όπου υπάρχει ο χαρακτήρας "."
να μετατρέψεις κάθε substring σε ακέραιο,
ύστερα κάθε ακέραιο σε δυαδική μορφή,
και τέλος, να τα ξανασυνθέσεις όλα αυτά σε ένα καινούριο String

Τη μετατροπή σε δυαδικό υποθέτω θα πρέπει να την κάνεις με μια δική σου συνάρτηση/διαδικασία
ενώ για τα υπόλοιπα θα βρεις κατάλληλες συναρτήσεις της pascal
Φιλικά,
Γιώργος Θαλασσινός

Ma8hths

Δεν κατάλαβα, :D πως γίνετε να μετατρέψω έναν string σε integer;Υπάρχουν έτοιμες συναρτήσεις της Pascal;

dpa2006

δες παρακάτω:
http://www.learn-programming.za.net/programming_pascal_learn04.html

The Val command converts a string to an integer.

program Convert;
 
var
   s: String;
   i: Integer;
   e: Integer;
 
begin
   s := '123';
   Val(s,i,e);
end.
Computer science (abbreviated CS or CompSci) is the scientific and practical approach to computation and its applications. It is the systematic study of the feasibility, structure, expression, and mechanization of the methodical processes (or algorithms) that underlie the acquisition, representation, processing, storage, communication of, and access to information, whether such information is encoded in bits and bytes in a computer memory or transcribed engines and protein structures in a human cell.source:http://en.wikipedia.org/wiki/Computer_science

Ma8hths

Ευχαριστώ με βοηθήσατε αρκετά...  ;)