làm sao chuyển file CSV có chứa thông tin để chương trinh C trên đọc, rui là sao chuyển kết quả chạy dc qua JSON z mình ko hiểu cách nó làm ạ!
#include <stdio.h>
int main()
{
float latitude;
float longitude;
char info[80];
int started =0 ;
puts("data=[");
while (scanf("%f,%f,%79[^\n]",&latitude ,&longitude ,info ) == 3) {
if (started)
printf(",\n");
else
started =1 ;
printf("{latitude: %f, longitude: %f, info: '%s'}",latitude ,longitude ,info );
}
puts("\n]");
return 0;
}
file CSV nó thế này
42.363400,-71.098465,Speed = 21
42.363327,-71.097588,Speed = 23
42.363255,-71.096710,Speed = 17
42.363182,-71.095833,Speed = 22
42.363110,-71.094955,Speed = 14
42.363037,-71.094078,Speed = 16
42.362965,-71.093201,Speed = 18
42.362892,-71.092323,Speed = 22
42.362820,-71.091446,Speed = 17
42.362747,-71.090569,Speed = 23
42.362675,-71.089691,Speed = 14
42.362602,-71.088814,Speed = 19
42.362530,-71.087936,Speed = 16
42.362457,-71.087059,Speed = 16
42.362385,-71.086182,Speed = 21
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?