HELLO程序详解

来源:互联网 发布:神童vb第二章五 编辑:程序博客网 时间:2024/06/06 00:29


#include "stdafx.h" //Standard Application Framework Extensions(标准应用程序框架的扩展)
#include <iostream.h>
// Function prototypes
bool SayHello(char* szTo, int nCalc);
void SayGoodbye();

// Constants
#define NUMERO_UNO 1
const char* OLD_FRIEND = "old friend, for now.";


int main(int argc, char* argv[])
{
    char* szCpp = "C++!";  // Declare a variable.
    // Call a function with a Boolean result.
    if(SayHello(szCpp, 2))
    {
        // Call a function with no result.
        SayGoodbye();
    }


 return 0;
}

////////////////////////////////////////
// Global function definitions
// SayHello takes two parameters and returns a result.
bool SayHello(char* szTo, int nCalc)
{
    // Use an iostream object for output.
    cout << "Hello, " << szTo << " You're Number " << NUMERO_UNO
        << ".\n";
    return (nCalc + (nCalc * 2)) < (24/nCalc);
}
// SayGoodbye takes no parameters and returns no result.
void SayGoodbye()
{
    cout << "Bye, " << OLD_FRIEND << endl;
}


0 0
原创粉丝点击