C/C++/VC ʵÏÖ×Ö·û´®Äæ×ªµÄ¶àÖÖ·½·¨
/¼ÓÁËÏÂÃæÁ½¸öÍ·Îļþ£¬ÊÇΪÁËÔÚWin32¹¤³ÌÖÐʹÓÃMFCµÄÌØÐÔ!
#include <afx.h>
#include <afxwin.h>
#include "stdio.h"
#include "conio.h"
////¼ÓÁËÏÂÃæÁ½¾ä£¬ÊÇΪÁËÄܹ»ÓÃstring(basic_stringÀàÐÍ)
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
// string _strtemp = "1111";
// TRACE("\n string = %s \n",_strtemp.c_str() );
// printf("\n string = %s \n",_strtemp.c_str() );
// printf("\n Hello World! \n");
// getch();
CString sTemp;
sTemp.Format("jkgja");
AfxMessageBox(sTemp);
return 0;
}
/************************************************************************/
/* ʵÏÖ×Ö·û´®Äæ×ª */
/************************************************************************/
/////·½°¸Ò» Óô¿Cº¯ÊýʵÏÖ
/*#include <iostream>
#include <string>
using namespace std;
int main()
{
string str = "abcdefghijklmn";
cout<<str.c_str()<<endl;
cout<<strrev(strdup(str.c_str()))<<endl;
system("pause");
return 0;
}*/
///// ·½°¸¶þ ÓÃSTLº¯ÊýʵÏÖ
// reverse_copy.cpp
// compile with: /EHsc
// Illustrates how to use the reverse_copy function.
//
// Functions:
// reverse_copy - Reverse a sequence, copy the results to another
// same-sized sequence.
//
//////////////////////////////////////////////////////////////////////
/*
// disable warning C4786: symbol greater than 255 character,
// okay to ignore
#pragma warning(disable
Ïà¹ØÎĵµ£º
Delphi Óë C/C++ Êý¾ÝÀàÐͶÔÕÕ±í
DelphiÊý¾ÝÀàÐÍC/C++
ShorInt
8λÓзûºÅÕûÊý
char
Byte
8λÎÞ·ûºÅÕûÊý
BYTE,unsigned short
SmallInt
16λÓзûºÅÕûÊý
short
Word
16λÎÞ·ûºÅÕûÊý
unsigned short
Integer,LongInt
32λÓзûºÅÕûÊý
int,long
Cardinal,LongWord/DWORD
32λÎÞ·ûºÅÕûÊý
unsigned long
Int6 ......
ÃæÏò¶ÔÏó±à³ÌºÍ½á¹¹»¯±à³Ì¼¸ºõÔÚͬһʱÆÚ³öÏÖ¡£µ«ÊÇÓÉÓÚÔçЩʱºòµÄ»úÆ÷»·¾³²»ÔÊÐí£¬ÈçÄÚ´æ¡¢cpuµÈ¡£µ¼ÖÂÃæÏò¶ÔÏó¼¼ÊõûÓеõ½¼°Ê±µÄ·¢Õ¹£¬¶øÍ¬Ê±ÒòΪ½á¹¹»¯³ÌÐò¶ÔÓ²¼þÒªÇó²»ÊÇÄÇôǿÁÒ£¬ËùÒÔ¼°Ê±µÄ·¢Õ¹ÆðÀ´ÁË¡£
µ«ÊÇËäÈ»Èç´Ë£¬¸ü¶àµÄÈËÔÚ̸µ½ÃæÏò¶ÔÏóʱ×ܾõµÃÊÇÖÖÓÅÔ½£¬×ܾõµÃ"¸ßÈËÒ»µÈ"£¬×ÔÈÏΪc++Ò»¶¨±ÈcÓÅÐã¡£ÏÂÃæÍ¨¹ýÓ ......
1. »ù±¾½âÊÍ
¡¡¡¡typedefΪCÓïÑԵĹؼü×Ö£¬×÷ÓÃÊÇΪһÖÖÊý¾ÝÀàÐͶ¨ÒåÒ»¸öÐÂÃû×Ö¡£ÕâÀïµÄÊý¾ÝÀàÐͰüÀ¨ÄÚ²¿Êý¾ÝÀàÐÍ£¨int,charµÈ£©ºÍ×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ£¨structµÈ£©¡£
¡¡¡¡ÔÚ±à³ÌÖÐʹÓÃtypedefÄ¿µÄÒ»°ãÓÐÁ½¸ö£¬Ò»¸öÊǸø±äÁ¿Ò»¸öÒ×¼ÇÇÒÒâÒåÃ÷È·µÄÐÂÃû×Ö£¬ÁíÒ»¸öÊǼò»¯Ò»Ð©±È½Ï¸´ÔÓµÄÀàÐÍÉùÃ÷¡£
¡¡¡¡ÖÁÓÚtypedefÓÐʲô΢ÃîÖ®´ ......
º¯Êý - ÉùÃ÷¡¢¶¨Òå¡¢µ÷ÓÃ
¡¡¡¡1. Èç¹ûº¯ÊýûÓÐÉùÃ÷, Ó¦¸ÃÔÚµ÷ÓÃǰ¶¨Òå:
#include¡¡<stdio.h>
/*¡¡¶¨ÒåÇó´óÖµº¯Êý¡¡*/
int¡¡MAX(int¡¡x,¡¡int¡¡y)¡¡{
¡¡¡¡if¡¡(x¡¡>¡¡y)
¡¡¡¡¡¡¡¡return¡¡x;
¡¡¡¡else
¡¡¡¡¡¡¡¡return¡¡y;
}¡¡
/*¡¡¶¨ÒåÇóСֵº¯Êý¡¡*/
int¡¡MIN(int¡¡x,¡¡int¡¡y)¡¡{
¡¡¡¡return¡¡x¡¡&l ......