CÎļþ²Ù×÷Óëfstream¶ÁÈ¡Îı¾ÎļþµÄЧÂʱȽÏ
Õ⼸ÌìÓÉÓÚÒª¶ÁÈ¡½Ï´óµÄÎı¾Îļþ£¬ËùÒԾͱȽÏÁËÒ»ÏÂÁ½ÕßÖ®¼äµÄЧÂÊÎÊÌâ¡£ ËùÒª¶ÁÈ¡µÄÎı¾Îļþ½á¹¹ÎªÃ¿ÐÐÓÉ5¸öÊý×é³É£¬int int int float int£¬²âÊÔµÄÎļþÓÐ33WÐУ¬´óСΪ9M¡£ÏÖÔÚÒª½«Æä¶Áµ½Ò»¸öcube½á¹¹ÌåÀïÃæÈ¥£¬½á¹¹ÌåÓÐ5¸ö³ÉÔ±±äÁ¿ÓëÖ®¶ÔÓ¦¡£ Á½ÖÖ²Ù×÷µÄ´úÂëÈçÏ start = clock();
while(1)
{
fscanf(fp,"%d %d %d %f %d",&tmpcube.x,&tmpcube.y,&tmpcube.z,&tmpcube.temp,&tmpcube.type);
cubes.push_back(tmpcube);
if (tmpcube.type == -1)
break;
}
end = clock(); start = clock();
while(1)
{
fp>>tmpcube.x>>tmpcube.y>>tmpcube.z>>tmpcube.temp>>tmpcube.type;
cubes.push_back(tmpcube);
if (tmpcube.type == -1)
break;
}
end = clock(); ×îºóÔÚÎҵĵçÄÔ(AMD4000+)ÉÏÔËÐеõ½µÄ½á¹ûΪǰÕß960ms×óÓÒ ºóÕß2400+ms
Ïà¹ØÎĵµ£º
CÓïÑÔ±àÒëÈ«¹ý³Ì
±àÒëµÄ¸ÅÄ±àÒë³ÌÐò¶ÁÈ¡Ô´³ÌÐò£¨×Ö·ûÁ÷£©£¬¶ÔÖ®½øÐдʷ¨ºÍÓï·¨µÄ·ÖÎö£¬½«¸ß¼¶ÓïÑÔÖ¸Áîת»»Îª¹¦ÄܵÈЧµÄ»ã±à´úÂ룬ÔÙÓÉ»ã±à³ÌÐòת»»Îª»úÆ÷ÓïÑÔ£¬²¢ÇÒ°´ÕÕ²Ù×÷ϵͳ¶Ô¿ÉÖ´ÐÐÎļþ¸ñʽµÄÒªÇóÁ´½ÓÉú³É¿ÉÖ´ÐгÌÐò¡£
±àÒëµÄÍêÕû¹ý³Ì£ºCÔ´³ÌÐò££>Ô¤±àÒë´¦Àí(.c)££ ......
C/C+ÓïÑÔstructÉî²ã̽Ë÷
×÷ÕߣºËᦻª ³ö´¦£ºPConline
1. structµÄ¾Þ´ó×÷ÓÃ
¡¡¡¡Ãæ¶ÔÒ»¸öÈ˵ĴóÐÍC/C++³ÌÐòʱ£¬Ö ......
Õ⼸ÌìÔÚʹÓÃÓÃCд¸öÏîÄ¿×éµÄ×Ô¶¯»¯²âÊÔ¹¤¾ßÀàËÆCGI³ÌÐò£¬µÚÒ»¸öÓöµ½µÄÎÊÌâ¾ÍÊDZàÂëÁË¡£
0~9 a~z A¡«ZÕâЩ×Ö·ûÊDz»»á±»±àÂëµÄ£¬µ«ÊDZÈÈçһЩÌØÊâ×Ö·û»òÊÇÖÐÎÄ£¬post»ògetÊý¾Ýʱ£¬»á¶ÔÊý¾Ý×Ô¶¯½øÐбàÂ룬±ÈÈ纺×Ö'ÖÐ',Èç¹ûÒ³Ãæ²ÉÓõÄÊÇgb2312±àÂ룬'ÖÐ'×ֻᱻ±àÂëΪ'%D6%D0'£¬ºöÂÔ'%'±êʶ,Á½¸öÊ®Áù½øÖÆÊý£¬¼´0xD6,0xD0£¬Áù¸ ......
C ÖУ¬
int ºÍlongµÄ·¶Î§Ò»Ñù£¬Ö»Äܱíʾ(-2^31~2^31)ÕûÊý£¬¼´£¨-20ÒÚ¡« 20ÒÚ£©
unsigned int Óëunsigned long ·¶Î§ÊÇ(0 ~2^32),40ÒÚ¶àÒ»µã¡£
Èç¹ûÒª±íʾ¸ü´óһЩµÄÕûÊý£¬ÕâÁ½ÖÖÊý¾ÝÀàÐ;Ͳ»ºÃÓÃÁË£¬ÔÚACMÖо³£Òª´¦ÀíÕâÑùµÄÊý¾ÝÀàÐÍ£¬ÒÔÇ°Îҵı¿·½·¨ÊÇ×öÒ»¸öÕûÐÎÊý×飬ÿ¸öa[i]´æһ룬ÕâÑù¼Ó¼õ ......