Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMPP/trayallocationPP/   (Wiener Entwicklungsmethode ©)  Datei vom 13.4.2020 mit Größe 788 B image not shown  

Quelle  String.vdmpp   Sprache: VDM

 
-- ===============================================================================================================
-- String helper class for converting numbers
-- By José Antonio Esparza and Kim Bjerge - spring 2010
-- ===============================================================================================================

class String
 types

 values

 instance variables
  static numeric : seq1 of char := "0123456789"

 operations

 static public NatToStr: nat ==> seq1 of char
 NatToStr (val) ==
 ( 
  dcl string : seq1 of char := " ";
  dcl x1 : nat := val;
  dcl x2 : nat;
  
  if val = 0 then string := "0";
  
  while x1 > 0 do
  ( 
   x2 := (x1 mod 10) + 1;
   string := [numeric(x2)] ^ string;
   x1 := x1 div 10;
  );
  
  return string;
 );

 functions

end String

97%


¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.