FMK-LOG

Решение задачи 1

#include <stdio.h>
#include 
#include 

void main(void)
{
   FILE *in, *out;
   char rim[5], *rimdig[]={"I","II","III","IV","V","VI","VII","VIII","IX","X"};
   int i=0;

   if ((in = fopen("INPUT.TXT", "rt")) == NULL)
    {
      fprintf(stderr, "Cannot open input file.\n");
      return;
    }
    fscanf(in, "%s", rim);
    fclose(in);
    while (strcmp(rim,rimdig[i++]));

   if ((out = fopen("OUTPUT.TXT", "wt")) == NULL)
   {
      fprintf(stderr, "Cannot open output file.\n");
      return;
   }
   fprintf(out,"%d",i);
   fclose(out);
}

Тесты к задачам по информатике




Сайт создан в системе