/*===========CLS file process===========*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
const double INF = 1e5;
const double EPS = 1e-8;
char str[1000];
int main()
{
double ret = INF, tmp;
freopen("cls-2.cls","r",stdin);//cls和cpp置于同一目录下
while(gets(str)!=NULL){
if(strstr(str,"GOTO/")){
int len = strlen(str);
int flg = 2, i;
for(i=0; i<len && flg; i++){
if(str[i]==',') flg--;
}
for(int j=i;j<=len;j++) str[j-i] = str[j];
tmp = atof(str);
//printf("Get data = %.4f\n",tmp);
if(tmp < ret) ret = tmp;
}
}
printf("******************************\n");
if(fabs(ret-INF)<EPS) printf("Found no \"GOTO/\" data!\n");
else printf("The minimum data is %.4f\n",ret);
return 0;
}
C语言版。。。