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

📄 calculus.cpp

📁 This is a program that will let you calculate roots with the Quadratic formula (including complex ro
💻 CPP
字号:
#include <iostream>
#include "Calc.h"

using namespace std;

int main()
{
	cout << "**********************************************************"<<endl;
	cout << "*               Written By: Jaco van Staden              *"<<endl;
	cout << "*               Date: 13 July 2002                       *"<<endl;
	cout << "*               Program: Maths Program                   *"<<endl;
	cout << "**********************************************************"<<endl<<endl;
	
	cout << "++++++++++++++++++++"<<endl;
	cout << "+    MAIN MENU     +"<<endl;
	cout << "++++++++++++++++++++"<<endl;
	cout << "Please select an option:"<<endl;
	cout << "------------------------"<<endl;
	cout << "(1) Quadratic Equation"<<endl;
	cout << "(2) Fibonnaci Series "<<endl;
	cout << "(3) Pascals Trianlge "<<endl;
	cout << "(4) Factorial"<<endl<<endl;
	cout << "(5) Exit"<<endl;
	cout << "PLEASE MAKE YOUR SELECTION :";
	
	int Answer;
	cin >> Answer;
	void Valid(int &);
	Valid(Answer);

	void calculation(int);
	calculation(Answer);

	return 0;
}

void Valid(int &choice)
{
	while((choice >= 5) || (choice <= 0))
	 {
	  cout <<"ERROR"<<endl;
	  cout <<"Invalid choice, only 1-4. Re-enter choice :";
	  cin >> choice;	
	 }
}

int calculation(int option)
{
	Calculus sum;
	char again;	
	switch(option)
	 {
	  case 1:
		sum.Quadratic();
		cout <<"Do another calcualtion (Y/N):";
		cin >> again;
		while(again == 'Y'||again == 'y')
		 {
			sum.Quadratic();
			cout <<"Do another calcualtion (Y/N):";
		    cin >> again;
		 }
		return main();
		

	  case 2:
	    sum.Fibonnaci();
	    cout << "Do another calcualtion (Y/N):";
	    cin >> again;
	    while(again == 'Y'||again == 'y')
 		 {	
		   	sum.Fibonnaci();
	   	 	cout <<"Do another calculation (Y/N):";
	   		cin >> again;	
		 }
	    return main();	
	 

	 case 3:
	   sum.Pascal();
	   cout << "Do another calcualtion (Y/N):";
	   cin >> again;
	   while(again == 'Y'||again == 'y')	
        {	
			sum.Pascal();
	   	 	cout <<"Do another calculation (Y/N):";
	   		cin >> again;	
	    }
	   return main();	
	

	 case 4:
	   sum.Factorial();
	   cout << "Do another calcualtion (Y/N):";
	   cin >> again;
	   while(again == 'Y'||again == 'y')	
        {	
		   sum.Factorial();
	   	   cout <<"Do another calculation (Y/N):";
	   	   cin >> again;	
	    }
	   return main(); 


	 case 5:
	  return 0;

	}
}

⌨️ 快捷键说明

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