yc's profileyc1229PhotosBlogLists Tools Help

Blog


    July 19

    第一章 快速入门

        通常main函数返回的值来确定程序是否成功执行完毕,大多数系统中,main函数返回值为0表示main函数成功执行完毕,任何其他非0的返回值都有操作系统定义的含义。main函数的形参个数有限。main函数的返回值必须是int型。
        函数返回值必须和函数的返回值相同,或者可以转换成函数类型。
        c:\aa>cl -GX prog1.cpp  微软编译器采用该命令进行编译 prog1.cpp是文件名
        在windows系统下查看状态,键入 c:\aa>echo %ERRORLEVEL%
        术语“流”试图说明字符是随着时间顺序生成或消耗的。
        当操作是输出操作符时,结果是左操作数的值,输出操作返回的值是输出流本身。
        endl 具有输出换行的效果,并刷新与设备相关联的缓冲区。通过刷新缓冲区,用户可立即看到写入到流中的输出。
        std::cout std::endl 前缀std::表明cout和endl是定义在命名空间std中的。使用命名空间程序员可以避免与库中定义的名字相同而起来无意冲突。因为标准库定义的名字是定义在命名空间中,所以我们可以按自己的意图使用相同的名字。
        "The sum of" 称为字符串字面值。
        已初始化的变量是指变量在定义时就给定一个值,未初始化变量则未给定初始值。给变量一个初始值几乎总是正确的,但不要求必须这样做。
        单行注释 //
        多行注释 /*    注释对不可嵌套
                      */
        退出for循环后,变量val不再可访问,循环终止后使用val是不可能的,然而不是所有的编译器都有这一要求。(VC++里并不是这个规则)
        读入未知数目的输入 while (std::cin>>value) ;
        文件结束符 Ctrl+z
        一般来说,我们将类定义放入一个文件中,要使用该类的任何程序都必须包含这个文件。依据惯例,类类型存储在一个文件中,其文件名如同程序的源文件名一样。
        标准库的头文件用尖括号<>括起来,非标准库的头文件用双引号" "括起来。

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://yc1229.spaces.live.com/blog/cns!C863EF037BDFF0CE!106.trak
    Weblogs that reference this entry
    • None