FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC

Développement d'applications avec le langage Panoramic
 
AccueilAccueil  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  MembresMembres  Connexion  
Derniers sujets
» trop de fichiers en cours
Bonne année... en chiffres romains Emptypar Marc Aujourd'hui à 11:42

» Bataille navale SM
Bonne année... en chiffres romains Emptypar jjn4 Hier à 17:39

» Une calculatrice en une ligne de programme
Bonne année... en chiffres romains Emptypar jean_debord Hier à 8:01

» Gestion d'un système client-serveur.
Bonne année... en chiffres romains Emptypar Pedro Jeu 25 Avr 2024 - 19:31

» Les maths du crocodile
Bonne année... en chiffres romains Emptypar jean_debord Jeu 25 Avr 2024 - 10:37

» Naissance de Crocodile Basic
Bonne année... en chiffres romains Emptypar jean_debord Jeu 25 Avr 2024 - 8:45

» Editeur EliP 6 : Le Tiny éditeur avec 25 onglets de travail
Bonne année... en chiffres romains Emptypar Froggy One Mer 24 Avr 2024 - 18:38

» Dessine-moi une galaxie
Bonne année... en chiffres romains Emptypar jjn4 Lun 22 Avr 2024 - 13:47

» Erreur END_SUB
Bonne année... en chiffres romains Emptypar jjn4 Lun 22 Avr 2024 - 13:43

» Bug sur DIM_LOCAL ?
Bonne année... en chiffres romains Emptypar papydall Dim 21 Avr 2024 - 23:30

» Form
Bonne année... en chiffres romains Emptypar leclode Dim 21 Avr 2024 - 18:09

» 2D_fill_color(résolu)
Bonne année... en chiffres romains Emptypar leclode Sam 20 Avr 2024 - 8:32

» Consommation gaz électricité
Bonne année... en chiffres romains Emptypar leclode Mer 17 Avr 2024 - 11:07

» on_key_down (résolu)
Bonne année... en chiffres romains Emptypar leclode Mar 16 Avr 2024 - 11:01

» Sous-programme(résolu)
Bonne année... en chiffres romains Emptypar jjn4 Jeu 4 Avr 2024 - 14:42

Navigation
 Portail
 Index
 Membres
 Profil
 FAQ
 Rechercher
Rechercher
 
 

Résultats par :
 
Rechercher Recherche avancée
Avril 2024
LunMarMerJeuVenSamDim
1234567
891011121314
15161718192021
22232425262728
2930     
CalendrierCalendrier
Le Deal du moment : -20%
-20% Récupérateur à eau mural 300 ...
Voir le deal
79 €

 

 Bonne année... en chiffres romains

Aller en bas 
AuteurMessage
jean_debord

jean_debord


Nombre de messages : 1249
Age : 69
Localisation : Limoges
Date d'inscription : 21/09/2008

Bonne année... en chiffres romains Empty
MessageSujet: Bonne année... en chiffres romains   Bonne année... en chiffres romains EmptyJeu 6 Jan 2022 - 8:39

Remarquez l'utilisation de la fonction SPLIT, avec des virgules comme séparateur pour avoir la chaîne vide comme premier élément.

Code:

' Conversion en chiffres romains
' D'apres dodicat sur le forum FreeBASIC
' https://www.freebasic.net/forum/viewtopic.php?f=7&t=29021&start=15#p288740

const MILLE = ", M, MM, MMM"
const CENT  = ", C, CC, CCC, CD, D, DC, DCC, DCCC, CM"
const DIX   = ", X, XX, XXX, XL, L, LX, LXX, LXXX, XC"
const UNIT  = ", I, II, III, IV, V, VI, VII, VIII, IX"

dim n%, m$(), c$(), d$(), u$()

split MILLE, ",", m()
split CENT,  ",", c()
split DIX,   ",", d()
split UNIT,  ",", u()

print "Bonne annee "; IntToRoman(2022)

end


function IntToRoman$ (num%)
  dim milliers$, centaines$, dizaines$, unites$

  milliers  = m(num \ 1000 + 1)
  centaines = c((num mod 1000) \ 100 + 1)
  dizaines  = d((num mod 100) \ 10 + 1)
  unites    = u(num mod 10 + 1)
  
  return milliers + centaines + dizaines + unites
end_function
Revenir en haut Aller en bas
http://www.unilim.fr/pages_perso/jean.debord/index.htm
 
Bonne année... en chiffres romains
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Bonne année
» Papydall vous souhaite une bonne année vingt vingt
» Bonne Année !
» Bonne année 2019
» Bonne Année 2023

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
FORUM DE DISCUSSION SUR LE LANGAGE PANORAMIC :: Expériences autour de PANORAMIC :: Crocodile Basic-
Sauter vers: