Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

c/c++ Êý×Öת³É×Ö·û´®, ×Ö·û´®×ª³ÉÊý×Ö

Êý×Öת×Ö·û´®£º
ÓÃC++µÄstreanstream:
#include <sstream>
#Include <string>
string num2str(double i)
...{
        stringstream ss;
        ss<<i;
        return ss.str();
}
×Ö·û´®×ªÊý×Ö£º
int str2num(string s)
 ...{  
        int num;
        stringstream ss(s);
        ss>>num;
        return num;
}
ÉÏÃæ·½·¨ºÜ¼ò±ã, ȱµãÊÇ´¦Àí´óÁ¿Êý¾Ýת»»ËٶȽÏÂý..
C libraryÖеÄsprintf, sscanf Ïà¶Ô¸ü¿ì
¿ÉÒÔÓÃsprintfº¯Êý½«Êý×ÖÊä³öµ½Ò»¸ö×Ö·û»º³åÇøÖÐ. ´Ó¶ø½øÐÐÁËת»»...
ÀýÈ磺
ÒÑÖª´Ó0µã¿ªÊ¼µÄÃëÊý(seconds) £¬¼ÆËã³ö×Ö·û´®"H:M:S",  ÆäÖÐHÊÇСʱ, M£½·ÖÖÓ£¬S£½Ãë
         int H, M, S;
        string time_str;
        H=seconds/3600;
        M=(seconds%3600)/60;
        S=(seconds%3600)%60;
        char ctime[10];
        sprintf(ctime, "%d:%d:%d", H, M, S);             // ½«ÕûÊýת»»³É×Ö·û´®
        time_str=ctime;                                                 // ½á¹û
Óësprintf¶ÔÓ¦µÄÊÇsscanfº¯Êý, ¿ÉÒÔ½«×Ö·û´®×ª»»³ÉÊý×Ö
    char    str[] = "15.455";
    int     i;
    float     fp;
    ssca


Ïà¹ØÎĵµ£º

ÓÃCдµÄ3DÃÔ¹¬

          Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
       ´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸е쬻î»î»î£¡
         &n ......

Linux Cµ÷ÊÔÈëÃÅ

1.×Ô¶¨ÒåÊä³ö
  Ïë±Ø´ó¼Ò¶¼ÓÐÀûÓÃÊä³öº¯ÊýÈçprintfÀ´°ïÖúÎÒÃǵ÷ÊÔ³ÌÐòµÄ¾­Àú£¬ÕâÊÇÒ»ÖֱȽÏԭʼµÄ³ÌÐòµ÷ÊÔ¸¨Öú·½·¨£¬ÔÚLinuxÏÂÒ²¿ÉÒÔΪÎÒÃÇËùÓᣲ»¹ýÕâÖÖ·½·¨ÓÐÒ»¸öÃ÷ÏÔµÄȱµã£¬¾ÍÊÇÔÚµ÷ÊÔÍêºóÎÒÃDZØÐë×¢ÊÍ»òɾ³ýµôÕâЩ¸¨Öú´úÂë¡£Linux CÌṩÁË-DDEBUGÕâ¸ö±àÒë±ê¼ÇÀ´¶¨ÒåDEBUGÕâ¸ö·ûºÅ£¬½èÖúÓڸ÷ûºÅ£¬ÎÒÃÇ¿ÉÒÔÔÚÓ¦Ó ......

C/C++ÓïÑÔstructÉî²ã̽Ë÷

1. structµÄ¾Þ´ó×÷ÓÃ
¡¡¡¡Ãæ¶ÔÒ»¸öÈ˵ĴóÐÍC/C++³ÌÐòʱ£¬Ö»¿´Æä¶ÔstructµÄʹÓÃÇé¿öÎÒÃǾͿÉÒÔ¶ÔÆä±àдÕßµÄ
±à³Ì¾­Ñé½øÐÐÆÀ¹À¡£ÒòΪһ¸ö´óÐ͵ÄC/C++³ÌÐò£¬ÊƱØÒªÉ漰һЩ(ÉõÖÁ´óÁ¿)½øÐÐÊý¾Ý×éºÏ
µÄ½á¹¹Ì壬ÕâЩ½á¹¹Ìå¿ÉÒÔ½«Ô­±¾ÒâÒåÊôÓÚÒ»¸öÕûÌåµÄÊý¾Ý×éºÏÔÚÒ»Æð¡£´ÓijÖ̶ֳÈÉÏÀ´
˵£¬»á²»»áÓÃstruct£¬ÔõÑùÓÃstructÊÇÇø± ......

C struct ÖÐ×Ö½Ú¶ÔÆëÎÊÌâ


VCÖÐÏÂÃæ¼¸¸ö½á¹¹Ìå´óС·Ö±ðÊǶàÉÙÄØ
struct MyStruct
{
    double m4;
    char m1;
    int  m3£»
};
struct MyStruct {
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ