fig03_04.cpp

来自「经典vc教程的例子程序」· C++ 代码 · 共 37 行

CPP
37
字号
// Fig. 3.4: fig03_04.cpp
// Finding the maximum of three integers
#include <iostream.h>

int maximum( int, int, int );   // function prototype

int main()
{
   int a, b, c;

   cout << "Enter three integers: ";
   cin >> a >> b >> c;

   // a, b and c below are arguments to 
   // the maximum function call
   cout << "Maximum is: " << maximum( a, b, c ) << endl;

   return 0;
}

// Function maximum definition
// x, y and z below are parameters to 
// the maximum function definition
int maximum( int x, int y, int z )
{
   int max = x;

   if ( y > max )
      max = y;

   if ( z > max )
      max = z;

   return max;
}

⌨️ 快捷键说明

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