• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            把握命運,追逐夢想

            對自己所做的事要有興趣,同時還要能夠堅持不懈

            統計

            留言簿(1)

            閱讀排行榜

            評論排行榜

            #

            sizeof的大小

            #include<stdio.h>
            void func(char str[100]);
            int main()
            {

                
            char str[] = "fasfsdge";
                
            char* p = str;
                
            int n = 10;

                printf(
            "%d\n",sizeof(str));
                printf(
            "%d\n",sizeof(p));
                printf(
            "%d\n",sizeof(n));

                func(str);

                
            return 0;
            }


            void func(char str[100])
            {
                printf(
            "%d\n",sizeof(str));
            }

            posted @ 2009-07-30 13:43 把握命運 閱讀(181) | 評論 (0)編輯 收藏

            行之和,列之和相等

            #include<stdio.h>
            #include
            <memory.h>

            int main()
            {
                
            int num  = 0;
                
            while(1)
                
            {
                    printf(
            "請輸入矩陣每邊的數字個數(個數必須大于1的奇數):");    
                    scanf(
            "%d",&num);
                    
            if(num>1 && num%2 == 1)
                    
            {
                        
            break;
                    }

                    
            else
                    
            {
                        printf(
            "個數必須是大于1的奇數\n");
                    }

                }


                
            int *matrix  = new int[num*num];

                memset(matrix,
            0,num*num*sizeof(int));

                
            int row = 0,col = 0;
                row 
            = 0;
                col 
            = (num-1)/2;
                
            int i = 1;

                
            while( i <= num*num)
                
            {
                    
            if(col<0)
                    
            {
                        col 
            = col+num;
                    }

                    col 
            = col%num;
                    
            if(row<0)
                    
            {
                        row 
            = row+num;
                    }

                    row 
            = row%num;

                    
            if(matrix[row*num+col] != 0)
                    
            {
                        row 
            +=2;
                        
                        col
            --;
                        
                    }

                    
            else
                    
            {
                        matrix[row
            *num+col]= i;
                        row
            --;
                        col
            ++;
                        i
            ++;
                    }

                }


                
            int ii = 0,jj =0;
                
            for(; ii*num+jj<num*num; jj= ++jj%num)
                
            {
                    
            if(jj == num-1)
                    
            {
                        printf(
            "%d\n",matrix[ii*num+jj]);
                        ii
            ++;
                    }

                    
            else
                    
            {
                        printf(
            "%d\t",matrix[ii*num+jj]);
                    }

                }


                
            return 0;
            }

            posted @ 2009-07-30 13:21 把握命運 閱讀(115) | 評論 (0)編輯 收藏

            不能在函數中,通過參數創建動態大小的數組

            void func(int m,int n)
            {
                
            int a[m*n];
                
            int a[0=9;
            }


            int main()
            {
                func(
            5,4);
                
            return 0;
            }

            //上面的編譯無法通過

            posted @ 2009-07-30 11:14 把握命運 閱讀(192) | 評論 (0)編輯 收藏

            使用VC的內存查看數組指針越界

            #include<stdio.h>

            int main()
            {

                
            int *= (int*)malloc(sizeof(int)*50);
                
            for(int i = 0; i<50; i++)
                
            {
                    
            *(p+i) = i+2;
                }


                
            int * q =p;
                
            ++q;

                printf(
            "value is %d\n",*p);
                printf(
            "value is %d\n",*q);
                printf(
            "value is %d\n",*(p+49));
                printf(
            "value is %d\n",*(q+49));

                free(p);

                printf(
            "value is %d\n",*p);
                printf(
            "value is %d\n",*q);
                printf(
            "value is %d\n",*(q+1));
                printf(
            "value is %d\n",*(q+2));

                
            return 0;
            }


            posted @ 2009-07-30 09:47 把握命運 閱讀(517) | 評論 (0)編輯 收藏

            關于C的內存分布

            #include<stdlib.h>
            #include
            <memory.h>
            #include
            <string.h>
            #include
            <stdio.h>

            int func(void)
            {
                
            static int i = 0;
                
            return ++i;
            }



            int a = 0;
            char *p1;
            int main()
            {

                
            int b ;
                
            char s[]= "abc";
                
            char *p2;
                
            char *p3 ="123456";
                
            static int c = 0;
                p1 
            = (char*)malloc(10);
                p2 
            = (char*)malloc(20);

                
            int *= &a;
                p 
            = &b;
                p 
            = &c;

                strcpy(p1,
            "123456");

                
            int i;
                i 
            = func();
                i
            = func();

                printf(
            "%d\n",i);

                
            return 0;
            }

            //使用VC內存察看來觀察

            posted @ 2009-07-30 09:21 把握命運 閱讀(112) | 評論 (0)編輯 收藏

            一個簡單的網絡小程序

                 摘要: //tcpsever.cpp#include"targetver.h"#define WIN32_LEAN_AND_MEAN#include<windows.h>#include<commctrl.h>#include<tchar.h>#include<winsock2.h>#include"resource.h"#include<s...  閱讀全文

            posted @ 2009-07-30 07:22 把握命運 閱讀(169) | 評論 (0)編輯 收藏

            一個time的例子 SYSTEMTIME

            // mfctime.cpp : 定義控制臺應用程序的入口點。
            //

            #include 
            "stdafx.h"
            #include 
            "mfctime.h"

            #ifdef _DEBUG
            #define new DEBUG_NEW
            #endif


            // 唯一的應用程序對象

            CWinApp theApp;

            using namespace std;

            int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
            {
                
            int nRetCode = 0;

                
            // 初始化 MFC 并在失敗時顯示錯誤
                if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
                
            {
                    
            // TODO: 更改錯誤代碼以符合您的需要
                    _tprintf(_T("錯誤: MFC 初始化失敗\n"));
                    nRetCode 
            = 1;
                }

                
            else
                
            {
                    
            // TODO: 在此處為應用程序的行為編寫代碼。
                    time_t t;
                    time(
            &t);
                    tm 
            *newtime;
                    newtime 
            = localtime(&t);

                    printf(
            "%s",asctime(newtime));


                    
            //C++寫法
                    SYSTEMTIME tt;
                    GetLocalTime(
            &tt);

                    CString str;
                    str.Format(_T(
            "%u/%u/%u  %u:%u:%u:%u"),
                        tt.wYear, tt.wMonth, tt.wDay,
                        tt.wHour, tt.wMinute, tt.wSecond,
                        tt.wMilliseconds);

                    LPTSTR lpsz 
            = new TCHAR[str.GetLength()+1];
                    _tcscpy(lpsz, str);
                    wprintf(L
            "%s",lpsz);


                }


                
            return nRetCode;
            }

            posted @ 2009-07-29 17:43 把握命運 閱讀(1402) | 評論 (0)編輯 收藏

            isdigit用法

            如果參數是'0''9',那么返回非0,否則返回0

            posted @ 2009-07-29 16:41 把握命運 閱讀(283) | 評論 (0)編輯 收藏

            strstr的用法

            #include<stdio.h>
            #include
            <string.h>

            int main()
            {
                
            //找出后串在前串中的匹配的第一個指針。
                char *str1 = "hdhgjgf";
                
            char *str2 ="dh";
                
            char *= 0;
                p 
            = strstr(str1,str2);

                printf(
            "%s",p);
                
            return 0;
            }

            posted @ 2009-07-29 15:56 把握命運 閱讀(606) | 評論 (0)編輯 收藏

            一個文件操作的例子

            #include<string.h>
            #include
            <stdio.h>
            int main()
            {
                FILE 
            *pFile;
                pFile 
            = fopen("myfile.txt","w+");

                
            char str[8= "qwertyu";
                fwrite(str,
            1,7,pFile);

                
            long pos = ftell(pFile);

                
            char ch = getc(pFile);

                
            int ret = 0;

                ret 
            = printf("%d",pos);
                ret 
            = printf("%c",ch);

                ret 
            = fseek(pFile,-5,2);

                
            if(ret != 0)
                
            {
                    printf(
            "wrong");
                }

                 
                pos 
            = ftell(pFile);
                
                ch 
            =getc(pFile);
                ret 
            = printf("%d",pos);
                ret 
            = printf("%c",ch);

                
            char strbuf[6];
                
            //rewind(pFile);
                ret = fread(strbuf,1,3,pFile);

                printf(
            "%s",strbuf);

                fclose(pFile);
                
            return 0;

            }

            posted @ 2009-07-29 15:45 把握命運 閱讀(146) | 評論 (0)編輯 收藏

            僅列出標題
            共5頁: 1 2 3 4 5 
            国产一久久香蕉国产线看观看 | 久久婷婷成人综合色综合| 久久丫忘忧草产品| 久久精品99久久香蕉国产色戒 | 国产激情久久久久影院老熟女免费 | 国产精品久久影院| 国产午夜福利精品久久| 理论片午午伦夜理片久久| 亚洲av日韩精品久久久久久a| 久久人与动人物a级毛片| 精品久久久久久久久中文字幕| 久久精品国产精品亚洲| 亚洲国产一成人久久精品| 久久本道综合久久伊人| 久久婷婷激情综合色综合俺也去| 久久99精品久久久久久野外| 婷婷伊人久久大香线蕉AV| 久久亚洲国产精品五月天婷| 99久久免费国产特黄| 欧美亚洲国产精品久久久久| 人人狠狠综合久久亚洲婷婷| 综合久久国产九一剧情麻豆 | 亚洲AV日韩精品久久久久| 深夜久久AAAAA级毛片免费看| 久久精品www人人爽人人| 热久久最新网站获取| 久久福利片| 99久久精品国产一区二区| 久久久久无码精品国产| 国产成年无码久久久免费| 久久毛片免费看一区二区三区| 99国产精品久久| 国产情侣久久久久aⅴ免费| 久久久久久精品成人免费图片| 日韩AV毛片精品久久久| 久久乐国产精品亚洲综合| 久久午夜福利电影| 午夜视频久久久久一区 | 久久精品国产亚洲AV无码麻豆| 亚洲精品乱码久久久久久按摩| 久久成人国产精品免费软件|