C %m.ns Êä³ö
#include <stdio.h>
#define N 19
int main()
{
int i;
for (i=0;i<=N;i++)
{
printf("%*.*s%-*.*s\n",N,i<=N/2?i:N-1,"*******************",\
N,i<=N/2?i+1:N-i+1,"*******************");
}
return 0;
}
%m.nsÖмäµÄm.nÊǶÔ%sµÄÐÞÊηû,
m±íʾ×Ö·û´®ÏÔʾʱµÄ×î´ó¿í¶È,³¬¹ýµÄ»á±»½Øµô,
n±íʾÏÔʾ×Ö·û´®Öеļ¸¸ö×Ö·û,
Èç¹ûn<m,ÔòÊý¾Ý¿¿ÓÒ¶ÔÆëÏÔʾ
%-m.ns,ÆäËüºÍÉÏÃæÒ»Ñù,Ö»ÊÇ¿¿×ó¶ÔÆë
%*.*s Á½¸öÐǺÅÀàËÆͨÅä·û,ËüµÄʵ¼ÊÖµÓɺóÃæµÄ²ÎÊý¾ö¶¨
Èçprintf("%*.*s",m,n,"********")¾ÍµÈ¼ÛÓÚ%m.ns
ÏÖÔÚÕâ¶ÎºÃÀí½âÁË
printf("%*.*s%-*.*s\n",N,i<=N/2?i:N-i,"*******************",N,i<=N/2?i+1:N-i+1,"*******************");
½«ÆÁÄ»·Ö³É19+19Á½°ë,Ç°ÃæÒ»°ëÓÉ%*.*s¿ØÖÆ,ºóÃæÒ»°ëÓÉ%-*.*s¿ØÖÆ
µ± i<=N/2ʱ,ÿÐÐÊä³ö i+(i+1)=2i+1 ¸öÐǺÅ
µ± i>N/2 ʱ,ÿÐÐÊä³ö (N-i)+(N-i+1)=2(N-i)+1 ¸öÐǺÅ
ת×Ô £ºhttp://www.oldlinux.org/oldlinux/viewthread.php?tid=9962&extra=page%3D2
Ïà¹ØÎĵµ£º
º¯ÊýÃûÓ뺯ÊýÖ¸Õë
º¯Êý´æ·ÅÔÚÄÚ´æµÄ´úÂëÇøÓòÄÚ£¬ËüÃÇͬÑùÓеØÖ·£¬ÎÒÃÇÈçºÎÄÜ»ñµÃº¯ÊýµÄµØÖ·ÄØ£¿
Èç¹ûÎÒÃÇÓÐÒ»¸öint test(int a)µÄº¯Êý£¬ÄÇô£¬ËüµÄµØÖ·¾ÍÊǺ¯ÊýµÄÃû×Ö£¬ÕâÒ»µãÈçͬÊý×éÒ»Ñù£¬Êý×éµÄÃû×Ö¾ÍÊÇÊý×éµÄÆðʼµØÖ·¡£
Ò» ͨ³£µÄº¯Êýµ÷ÓÃ
Ò»¸öͨ³£µÄº¯Êýµ÷ÓõÄÀý×Ó ......
1.MFCÖеķ½·¨£º(C++)
CFileStatus status;
CFile::GetStatus("D:\\test.txt",status);
long lSizeOfFile;
lSizeOfFile = status.m_size;
lSizeOfFileµÄÖµ¾ÍÊÇD:\\test.txtÎļþµÄ´óС
2.±ê×¼C»ñµÃÎļþ´óСµÄ5ÖÖ·½·¨
(×¢Ò⣺"__FILE__"Ö¸µÄÊǵ±Ç°Îļþ£¬Äã¿ÉÒÔ¸ÄΪÓÐЧ·¾¶µÄÄ¿±êÎļþ£¬±ÈÈç"D:\\test.txt"£©
#i ......
ACE×ÔÊÊÅäͨÐÅ»·¾³£¨ADAPTIVE Communication Environment£©ÊÇ¿ÉÒÔ×ÔÓÉʹÓᢿª·ÅÔ´ÂëµÄÃæÏò¶ÔÏó£¨OO£©¿ò¼Ü£¨Framework£©£¬ÔÚÆäÖÐʵÏÖÁËÐí¶àÓÃÓÚ²¢·¢Í¨ÐÅÈí¼þµÄºËÐÄģʽ¡£ACEÌṩÁËÒ»×é·á¸»µÄ¿É¸´ÓÃC++ Wrapper Facade£¨°ü×°Íâ¹Û£©ºÍ¿ò¼Ü×é¼þ£¬¿É¿çÔ½¶àÖÖƽ̨Íê³ÉͨÓõÄͨÐÅÈí¼þÈÎÎñ£¬ÆäÖаüÀ¨£ºÊ¼þ¶à··ÖÀëºÍʼþ´¦À ......
ÔÚÕâÀïÌùÉÏ×î½ü×Ô¼ºÃ¦»îµÄÓÃturbo C±àдµÄ“´ò×ÖÓÎÏ·”µÄÔ´´úÂ룺
#include<graphics.h>
#include<conio.h>
#include<STDLIB.h>
#include<dos.h>
#define BK_COLOR BLACK
#define CHAR_COLOR WHITE
#define C_COLOR BLUE
#define num 10
#define SPEED 3000
#define Esc 27
# ......
C·ç¸ñ×Ö·û´®£º¶Ô×Ö·û´®½øÐвÙ×÷µÄ C º¯Êý¶¨ÒåÔÚÍ·Îļþ<cstring>ÖУ»
1. ×Ö·û´®¶¨Ò壺char* result£»
2. ×Ö·û´®µÄ×îºóÒ»¸ö×Ö·ûÊÇnull×Ö·û£¨'\0'£©£¬¿ÉÒÔͨ¹ýÕâ¸ö×Ö·ûÈ·¶¨×Ö·û´®µÄ½áβ¡£
3. strlen()·µ»ØµÄÊÇ×Ö·û´®µÄ´óС£»Òò´Ë£¬ ......