ex2_03.cpp
来自「一本语言类编程书籍」· C++ 代码 · 共 23 行
CPP
23 行
// Exercise 2.3 Converting a length in inches to feet-and-inches.
#include <iostream>
using std::cin;
using std::cout;
int main() {
const int inches_per_foot= 12;
long length_inches = 0L;
cout << "This program converts inches into feet-and-inches.\n";
cout << "Please enter the number of inches: ";
cin >> length_inches;
long feet = length_inches / inches_per_foot;
long inches = length_inches % inches_per_foot;
cout << "\nIn " << length_inches << " inches there are "
<< feet << " feet and " << inches << " inch(es).\n";
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?