⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 C++ Source code from a tutorial
💻 CPP
字号:
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

#ifdef UNIVAC
const int total = 200;
const string compname = "UNIVAC";
#elif defined(HAL2000)
const int total = 300;
const string compname = "HAL2000";
#else
const int total = 400;
const string compname = "My Computer";
#endif


// This is outdated, but you might 
// see it on occasion. Don't write
// code yourself that does this!
#define oldmax(x, y) ((x)>(y)?(x):(y))
#define MYSPECIALNUMBER 42

int main(int argc, char *argv[])
{
    cout << "Welcome to " << compname << endl;
    cout << "Total is:" << endl;
    cout << total << endl << endl;

    // Try out the outdating things.    
    cout << "*** max ***" << endl;
    cout << oldmax(5,10) << endl;
    cout << oldmax(20,15) << endl;
    cout << MYSPECIALNUMBER << endl << endl;

    // Here are some standard
    // predefined macros.
    cout << "*** Predefined Macros ***" << endl;    
    cout << "This is file " << __FILE__ << endl;
    cout << "This is line " << __LINE__ << endl;
    cout << "Compiled on " << __DATE__ << endl;
    cout << "Compiled at " << __TIME__ << endl << endl;
    
    // Here's how some people use #define,
    // to specify a "debug" version or 
    // "release" version.
    cout << "*** total ***" << endl;
    int i;
    int j = 0;
    for (i = 0; i<total; i++) {
        j = j + i;
    }
#ifdef DEBUG
    cout << "The value of j is " << j << endl;
#else
    cout << j << endl;
#endif    

    system("PAUSE");	
    return 0;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -