ROMANO_DECIMAL_02.c



// conversiOn de romano a decimal

#include <stdio.h>
#include <stdlib.h>

#define I 1
#define V 5
#define X 10
#define L 50

// PROTOTIPOS DE FUNCION===========
void ciclo();
void procesa(char*);
//=================================
int main(int N, char **Args)
{
	ciclo();
	printf("Gracias por utilizar el convertidor ...\n\n\n");
}

void ciclo()
{
	char *romano=malloc(80);

	system("clear");
	while( 1 )
	{
		printf("Numero romano: ");
		scanf("%s", romano);
		if ( romano[0]=='z' ) break;
		procesa(romano);
	}
}

void procesa(char *romano)
{
	while ( romano[0] != '\0' )
	{
		printf("%c\t\t%i\n", romano[0], romano[0]);
		romano++;
	}
}

/*

		int x=5;
		x++;		// X=6

	romano = "MDLXXVIII"
	romano = ['M','D','L','X','X','V','I','I','I','\0' ]
		 [ 0   1   2   3   4   5   6   7   8    9  ]
	romano = "DLXXVIII"
	romano = "LXXVIII"
	romano = "\0"












inicio:	if ( romano[i] == '\0' ) goto fin;

	if ( romano[i] == 'I' ) { Ant = I; total += I; }
	if ( romano[i] == 'V' )
	{
		if ( Ant < V ) { total += V; }
		else	{ total = total+3; Ant = V; }
		Ant=V;
	}
	if ( romano[i] == 'X' )
	{
		if ( Ant < X ) { total = total+X-Ant; Ant = X; }
		else	total += X;
	}
	i++; goto inicio;


fin:	printf("Total= %d\n", total);
	printf("fin\n");
}
*/