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

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


Ïà¹ØÎĵµ£º

C´æ´¢ÀàÐͼ°¾²Ì¬¡¢´æ´¢ÀàÐÍÑó½â

 CµÄËÄÖÖ´æ´¢ÀàÏÞ¶¨·û£º
extern:Íⲿ±äÁ¿
static £º¾²Ì¬
register£º´æ´¢Æ÷
auto£º×Ô¶¯¡¡
¾²Ì¬¾Ö²¿±äÁ¿£º
´æ´¢ÇøºÍÈ«¾Ö±äÁ¿ÊÇÒ»ÑùµÄ¡£¾²Ì¬¾Ö²¿ºÍÈ«¾Ö±äÁ¿¼äµÄÖ÷񻂿±ðÊÇ£º¾²Ì¬¾Ö²¿±äÁ¿½ö¶ÔËüÔÚÆäÖÐÉùÃ÷µÄ¿éÊÇ¿ÉÖªµÄ¡£
¾²Ì¬È«¾Ö±äÁ¿£º
¸æËß±àÒëÆ÷´´½¨Ò»¸ö½öÔÚÉùÃ÷ËüµÄÎļþÖпÉÖªµÄÈ«¾Ö±äÁ¿¡£ÕâÒâζ×Å£º¼´Ê¹±äÁ¿Ê ......

extern "C" Ïê½â

 extern "C" Ïê½â
ÔÚC++ÖУ¬ÎªÁËÖ§³ÖÖØÔØ»úÖÆ£¬ÔÚ±àÒëÉú³É»ã±à´úÂëʱ£¬º¯ÊýµÄÃû×ÖÒª¼ÓÈ뺯ÊýµÄ²ÎÊýÀàÐÍ»òÕß·µ»ØÖµÀàÐ͵ÈÐÅÏ¢
ÔÚCÖУ¬ÒòûÓÐÖØÔØ»úÖÆ£¬±àÒëºóµÄ´úÂëÖ»ÊǼòµ¥µÄº¯ÊýÃû×Ö¶øÒÑ£¬²»¼ÓÈëÆäËûµÄÐÅÏ¢ 
1. ²»¼ÓÈëextern "C"
testexternc.cpp
int mytest(void)
{
int a=10,b=20;
int c=a+b;
ret ......

ŪÁ˰ëÒ¹¾ÍûÏëÃ÷°×£¬µô½øCÏÝÚåÁË£¬555

 
//ÊäÈëÒ»¸öÊý×飬ÔÙÐÞ¸ÄÕâ¸öÊý×éËùÓÐÔªËØ£¬ÈçºÎʵÏÖ£¿
int main()
{
 vector<int> a;
 int i(0);
 while(cin>>i)
  a.push_back(i);
 //////////////////////////////////////////////////////Êä³ö½¨Á¢µÄÊý×飺
 cout << "µÃµ½µÄÊý×éΪ£º" << ......

¾­µäc/c++Ëã·¨

¶þ·Ö²éÕҵĴúÂë.
int bfind(int* a,int len,int val)
{
    int m = len/2;
    int l = 0;
    int r = len;
    while(l!=m && r!= m)
    {
        if(a[m] > val)
  & ......

¿É±äÄ¿±êC±àÒëÆ÷ µÚ4Õ ÀàÐÍ

C³ÌÐòÖоßÓзḻµÄÊý¾ÝÀàÐÍ£¬°üÀ¨ÉùÃ÷ÖÐÏÔʽ¶¨ÒåµÄÀàÐͺÍÓÃ×ö±í´ïʽÖмäÀàÐ͵ĵ¼³öÀàÐÍ¡£ÀýÈ磬ÏÂÃæµÄ¸³ÖµÓï¾ä°üº¬3 ÖÖ²»Í¬ÀàÐÍ:
    int *p, x;
    *p = x;
xÊÇÒ»¸ö´æ·ÅÕûÊýµÄµ¥ÔªµÄµØÖ·£¬Òò´ËxµÄµØÖ·µÄÀàÐÍÊÇ£ºÖ¸ÏòÒ»¸öÕûÊýµÄÖ¸Õë¡£xµÄÖµµÄÀàÐÍÊÇÕûÐÍ¡£Í¬Ñù, pµÄ×óÖµµÄÀàÐÍÊÇÖ¸ÏòÒ»¸öÕ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ