main.cpp

来自「C++ Source code from a tutorial」· C++ 代码 · 共 40 行

CPP
40
字号
#include <iostream>
#include <stdlib.h>
#include <string>

using namespace std;

const int ParkingSpaces = 80;
const string StoreName = "Joe's Food Haven";
const float pi = 3.1415926;

int main(int argc, char *argv[])
{
    cout << "Important Message" << endl;
    cout << "Here at " << StoreName << endl;
    cout << "we believe you should know" << endl;
    cout << "that we have " << ParkingSpaces;
    cout << " full-sized" << endl;
    cout << "parking spaces for your parking" << endl;
    cout << "pleasure." << endl;
    cout << endl;
    
    cout << "We do realize, however, that parking" << endl;
    cout << "is tight at " << StoreName << endl;
    cout << "and so we are going to double our" << endl;
    cout << "spaces from " << ParkingSpaces << " to ";
    cout << ParkingSpaces * 2;
    cout << ". Thank you again!" << endl << endl;
    
    float radius = 5;
    float area = radius * pi * pi;
    
    cout << "And remember, we sell " << radius;
    cout << " inch apple pies" << endl;
    cout << "for a full " << area << " square" << endl;
    cout << "inches of eating pleasure!" << endl;
    
    system("PAUSE");	
    return 0;
}

⌨️ 快捷键说明

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