// #include <cstdlib>
#include <iostream>

using namespace std;
// ----------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include <math.h>
// ----------------------------------------------

int main(int argc, char *argv[])
{
	// Usage: bbb yyy.txt plot.scr
	if (argc != 3) {
		printf("Usgae: bbb yyy.txt plot.scr [Enter] \n");
		system("pause");
		
		exit(1);
	}
	
	FILE *f1, *f2;
	if ((f1= fopen(argv[1], "rt")) == NULL) {
		printf("*** error of fopen for %s \n", argv[1]);
		system("pause");
		
		exit(1);
	}
	
	if ((f2= fopen(argv[2], "wt")) == NULL) {
		printf("*** error of fopen for %s \n", argv[2]);
		system("pause");
		
		exit(1);
	}
	
	int ct;
	double x, y;
	
	fprintf(f2, "spline\n");
	while (!feof(f1)) {
		ct= fscanf(f1, "%le %le", &x, &y);// 1.23E+23, 1.23
		if (ct == 2) {
			fprintf(f2, "%.6lf,%.6lf\n", x, y);
		}
	}
	fprintf(f2, "\n\n\n");
	
	
	fclose(f1);
	fclose(f2);
	
	
	
	system("pause");
	return 0;
}
