4elist0501.cpp

来自「《21天学通C++》附盘的原代码。书上的每个例子在这里都有相应的C语言程序。」· C++ 代码 · 共 32 行

CPP
32 行
字号
// Listing 5.1 - demonstrates the use of function prototypes

#include <iostream>
int Area(int length, int width); //function prototype

int main()
{
	using std::cout;
	using std::cin;

	int lengthOfYard;
	int widthOfYard;
	int areaOfYard;

	cout << "\nHow wide is your yard? ";
	cin >> widthOfYard;
	cout << "\nHow long is your yard? ";
	cin >> lengthOfYard;

	areaOfYard= Area(lengthOfYard,widthOfYard);

	cout << "\nYour yard is ";
	cout << areaOfYard;
	cout << " square feet\n\n";
	return 0;
}

int Area(int l, int w)
{
	return l * w;
}

⌨️ 快捷键说明

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