⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_2_6.cpp

📁 c++程序设计讲义 cppprograming 含源码
💻 CPP
字号:
// Program 2.6: Compute the y-coordinate of a
// point on a line given the line and an x-coordinate
// Authors: Bryan Zeng
// Date: 7/24/2002

#include <iostream>
using namespace std;
int main() {
	// Input line s parameters
	cout << "Slope of line (integer)? ";
	int m;  // Line slope
	cin >> m;
	cout << "Intecept of y-axis (integer)? ";
	int b;  // y-intercept
	cin >> b;
	// Input x-coordinate of interest
	cout << "x-coordinate of interest (integer)? ";
	int x;  // x-coordinate of interest
	cin >> x;
	// compute and display y-coordinate
	int y;
	y = m * x + b;
	cout << "y = " << y << " when m = " << m << ";";
	cout << " b = " << b << "; x = " << x << endl;
	return 0;
}

⌨️ 快捷键说明

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