Vă rog! Am nevoie urgent! În Pascal
Răspunsuri la întrebare
Răspuns:
#include <iostream>
#include <string.h> #include <stdlib.h>
using namespace std;
int main()
{ char text[256], *p, separator[]="", x[256]=" ",
v[20][5], s[ 0][5] ;
int i, n = 7 ;
cout << "Dati cifrele arabe:" << endl << endl;
cin.get(text, 256);
strcpy(v[1],"1"); strcpy(s [1],^ prime prime l^ prime prime ) ;
strcpy(v[2],"5"); strcpy (s[2],^ prime prime V^ prime prime ) ;
strcpy(v[3], 10^ prime prime ); strcpy( :[3],"*") ; strcpy( v[4],"50");strcp (s[4],"L");
strcpy(v [5],^ prime prime 100^ prime prime );strc (s[5],"C");
strcpy(v [6],"50O");str; (s[ 6],^ prime prime D^ prime prime ) ; strcpy(v[7],"1000"); strcpy(s[7],^ prime prime M^ prime prime ) ;
p=strtok(text, separator);
while (p)
{ for(i=1;i<=n;i++) if(strcmp (p,v[i])==0)
strcpy(p,s[i]);
strcat(x,p);
strcat(x," ");
p=strtok(NULL,separator); }
cout << endl; cout << "Cifrele romane su -" <<
endl << endl;
cout <x ;}
Ex: Introduci 1 5 10 50 100 500 1000
Afiseaza IVXLCDM
Nu si alte numere. Daca vrei si alte numerele
adaugi tu cu "srtcpy".