33,311
社区成员
发帖
与我相关
我的任务
分享
void test(){
char tmp[5];
char *times[5]={"20:00","09:40","13:05","24:00","00:00"};
float f_times[5]={0};
for(a=0;a<5;i++)
{
strcpy(tmp,times[i]);
printf("%d\n",i);
tmp[2]='.';
f_times[i]=atof(tmp);
}
}
#include <Windows.h>
#include <stdlib.h>
#include <stdio.h>
void test();
int main()
{
test();
system( "pause" );
}
void test()
{
char tmp[6] = {0};
char *times[5]={ "20:00" , "09:40" , "13:05" , "24:00" , "00:00" };
float f_times[5]={0};
for( int a = 0 ; a < 5 ; a++ )
{
strcpy( tmp , times[a] );
printf( "%d\n" , a );
tmp[2] = '.';
f_times[a] = atof( tmp );
}
}