fork download
  1. #include <stdio.h>
  2. #define N 100
  3.  
  4. int main(void){
  5. double t[N], v[N];
  6. int i=0;
  7.  
  8. while(scanf("%lf,%lf",&t[i],&v[i])==2&&i<N)
  9. i++;
  10.  
  11. printf("No.\t時間[s]\t電位[V]\n");
  12.  
  13. int n=1;
  14. for(int j=1;j<i-1;j++){
  15. if(v[j]>v[j-1]&&v[j]>v[j+1])
  16. printf("%d\t%.6f\t%.6f\n",n++,t[j],v[j]);
  17. }
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5324KB
stdin
0.000000,2.510284
0.010000,2.897269
0.020000,2.907453
0.030000,2.938005
0.040000,2.948189
0.050000,2.978740
stdout
No.	時間[s]	電位[V]