CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС
CºÍC++ÖеÄÖ÷ÒªÊý¾ÝÀàÐͺÍ×Ö½Ú´óС(
C/C++µÄд·¨ÊDz»¿ÆѧºÍ²»ÑϽ÷µÄ¡£ÒòΪCºÍC++ËäÈ»ÓïÒ壬µ«ÊÇÉè¼Æ˼ÏëÊǽṹ»¯ÓëÃæÏò¶ÔÏó. C±ê×¼¹æ·¶ÓëC++µÄ±ê×¼¹æ·¶Ò²ÊÇÁ½¸öÎı¾¡£½üÀ´×ÐϸÑо¿ÁËËüÃǵÄÊý¾ÝÀàÐÍ£¬²ÅÖªµÀÆäÀ´ÁúÈ¥Âö£¬ÕæÕý×öµ½ÆäʵËùÒÔÈ»¡£
1¡¢CÓïÑÔ¶¨ÒåÁË5ÖÖ»ù±¾Êý¾ÝÀàÐÍ
char(×Ö·û), int(ÕûÊý), float(µ¥¾«¶È), double(Ë«¾«¶È),void;
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ£º
sizeof(char)=1, sizeof(int)=4, sizeof(float)=4, sizeof(double)=8;
sizeof(char*)=4;(ÈκÎÀàÐÍÖ¸Õë±äÁ¿Îª32λ¼´4¸ö×Ö½Ú)
2¡¢C++ÓïÑÔÓÚC»ù´¡ÉÏÔö¼Ó2ÖÖÊý¾ÝÀàÐÍ£º
bool(²¼¶û),wchar_t(¿í×Ö·û);
ÔÚ32λ»úÆ÷ÉÏ,sizeofµÄÆäÖµ·Ö±ðΪ:
sizeof(bool)=1, sizeof(wchar_t)=2, sizeof(bool*)=sizeof(wchar_t*)=4;
3¡¢Êý¾ÝÀàÐ͵Ļù±¾ÐÞÊηû:
signed(ÓзûºÅ), unsigned(ÎÞ·ûºÅ),long(³¤Õû),short(¶ÌÕû)
4¡¢²âÊÔ´úÂë:
size_t nchar=sizeof(char);
size_t nfloat=sizeof(float);
size_t ndouble=sizeof(double);
size_t nint = sizeof(int);
a.Format("CÓïÑÔÊý¾ÝÀàÐͳ¤¶È:char=%d,float=%d,double=%d,int=%d",nchar,nfloat,ndouble,nint);
AfxMessageBox(a);
nint = sizeof(int*);
nchar = sizeof(char*);
ndouble = sizeof(double*);
nfloat = sizeof(float*);
a.Format("CÓïÑÔÖ¸ÕëÀàÐͳ¤¶È:char*=%d,float*=%d,double*=%d,int*=%d",nchar,nfloat,ndouble,nint);
AfxMessageBox(a);
size_t nbool=sizeof(bool);
size_t nwchar=sizeof(wchar_t);
a.Format("C++ÐÂÔöÊý¾ÝÀàÐͳ¤¶È:bool=%d,wchar_t=%d,bool*=%d,wchar_t*=%d",nbool,nwchar,sizeof(bool*),sizeof(wchar_t*));
AfxMessageBox(a);
5.Àí½â´úÂë
//A
²ÉÓÃ32λѰַ·½Ê½£¬ÔòÊý×échar**[4][4]Õ¼ÓÃ×Ö½Ú=4*4*4×Ö½Ú(32bit)=64×Ö½Ú
//B
#include "stdio.h"
int main()
{
int *p;
printf("%d", sizeof(p));
return 0;
}
Ïà¹ØÎĵµ£º
ÒÔϵÄ×ö·¨ÕûÀí×ÔÂÛ̳ÉϵÄÌû×Ó¡£
ÈçºÎcreate´óÎļþ
Òª´ó¾Í·Ç³£´ó£¬1T°É¡£
ÓÐÁ½ÖÖ·½·¨£º
Ò».dd
dd if=/dev/zero of=1T.img bs=1G seek=1024 count=0
bs=1G±íʾÿһ´Î¶Áд1GÊý¾Ý£¬count=0±íʾ¶Áд0´Î£¬seek=1024±íʾÂÔ¹ý1024¸öBlock²»Ð´£¬Ç°Ãæblock sizeÊÇ1G£¬ËùÒÔ¹²ÂÔ¹ý1T£¡
ÕâÊÇ´´½¨´óÐÍsparseÎļþ×î¼ ......
A. ΪʲôҪÔÚLinuxʹÓÃEclipse¿ª·¢C/C++³ÌÐò?
LinuxÊÇÒ»¸öÒÔC/C++¿ª·¢ÎªÖ÷µÄƽ̨£¬ÎÞÂÛÊÇKernel»òÊÇApplication£¬Ö÷Òª¶¼Ê¹ÓÃC/C++¿ª·¢¡£´«Í³ÔÚLinuxÏ¿ª·¢³ÌÐò£¬ÊÇÔÚÎÄ×ÖģʽÏ£¬ÀûÓÃviµÈÎÄ×Ö±à¼Æ÷׫дC/C++³ÌÐò´æÅ̺ó£¬ÔÚCommand lineÏÂʹÓÃgcc±àÒ룬ÈôÒªdebug£¬ÔòʹÓÃgdb¡£
ÕâÖÖ¿ª·¢·½Ê½Éú²úÁ¦²¢²»¸ß£¬ÈôÖ»ÊÇ¿ª·¢Ñ§ ......
server:
import sys
import socket
host = sys.argv[1]
port = int(sys.argv[2])
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host,port))
while 1:
try:
&n ......
±¾ÎÄÌÖÂÛÁËC³ÌÐòµÄÍⲿ±äÁ¿ºÍº¯ÊýµÄһЩÐÔÖÊ£¬½áºÏʵ¼ÊµÄ±à³Ì£¬¸ø³öÁËʹÓÃÍⲿ±äÁ¿ºÍº¯ÊýµÄ·½·¨¡£
¹Ø¼ü×Ö£ºC³ÌÐò£¬Íⲿ±äÁ¿£¬º¯Êý
¡¡¡¡C³ÌÐòÓÉÒ»×é¶ÔÏó×é³É£¬ÕâЩ¶ÔÏó°üÀ¨³ÌÐòÖÐËùʹÓõıäÁ¿ºÍʵÏÖÌض¨¹¦Äܵĺ¯Êý¡£±äÁ¿¿ÉÒÔ·ÖΪº¯ÊýÄÚ²¿¶¨Ò塢ʹÓõıäÁ¿ºÍº¯ÊýÍⲿ¶¨ÒåµÄ±äÁ¿£¬Í¨³£Çé¿öÏ£¬°Ñº¯ÊýÄÚ²¿¶¨Ò塢ʹÓõıäÁ¿³ÆÎ ......
ÔÚ Web Ó¦ÓóÌÐò»·¾³ÖУ¬µü´úÖ÷ÒªÓÃÓڷôæºÍÏÔʾÊý¾Ý¼¯£¬Í¨³£ÊÇÒÔÁбí»ò±íÖеÄһϵÁÐÐеÄÐÎʽÏÔʾ¡£ÊµÏÖµü´úÄÚÈݵÄÖ÷Òª JSTL ²Ù×÷ÊÇ <c:forEach>; ¶¨ÖƱê¼Ç¡£¸Ã±ê¼ÇÖ§³ÖÁ½ÖÖ²»Í¬ÑùʽµÄµü´ú£ºÕûÊý·¶Î§Éϵĵü´ú£¨ÀàËÆ Java ÓïÑ﵀ for Óï¾ä£©ºÍ¼¯ºÏÉϵĵü´ú£¨ÀàËÆ Java ÓïÑ﵀ Iterator ºÍ Enumeration Àࣩ¡£
½øÐÐÕûÊ ......