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

📄 12v.cpp

📁 C/C++程序设计导论(第二版)》程序源文件
💻 CPP
字号:
// cmath3.cpp  A program to do complex math. Assumes
//  Complex can be treated as any other simple numerical data type.
#include <iostream.h>
#include "complex3.h"
void main ()
{	char choice;
	Complex a, b, c;					// three Complex variables
	cout << "enter a complex number pair: ";
	cin >> a;					// input cmplx into `a'
	cout << "enter a complex number pair: ";
	cin >> b;					// input cmplx into `b'
	cout << "enter choice: (a)dd, (s)ub, (m)ult: ";
	cin >> choice;					// get user's choice
	switch (choice)
	{	case 'a' :			c = a + b;	// add `b' to `a', assign to `c'
					break;
		case 's' :			c = a - b;		// sub `b' from `a'
					break;
		case 'm' :			c = a * b;		// mult `b' to `a'
					break;
		default : 			cout << "entry error";
	}
	cout << c;					// display results.
}

⌨️ 快捷键说明

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