intro4.cpp

来自「hello everybody. good lucky to you」· C++ 代码 · 共 22 行

CPP
22
字号
//INTRO4.CPP--Example from Chapter 3, "An Introduction to C++"

#include <iostream.h>

int main()
{
	float num, denom;     // numerator and denominator of fraction
	float value;          // value of fraction as decimal

	cout << "Convert a fraction to a decimal\n";
	cout << "Numerator: ";
	cin >> num;
	cout << "Denominator: ";
	cin >> denom;

	value = num / denom;  // convert fraction to decimal

	cout << '\n' << num << '/' << denom << '=' << value;

	return 0;
}

⌨️ 快捷键说明

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