Skip to content

jimmyberg/Complex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Made by Jimmy van den Berg in The Netherlands 1 October 2015

C++ library for complex number calculations.

This was a personal exersize, note that there is a standard library available.

Example

main.cpp

#include <iostream>
#include "Complex.hpp"
using namespace std;

int main(int argc, char** argv){
	Complex a(3, 4);
	Complex b(1, -2);
	cout << a << " + " << b << " = " << a + b << endl;
	cout << a << " - " << b << " = " << a - b << endl;
	cout << a << " * " << b << " = " << a * b << endl;
	cout << a << " / " << b << " = " << a / b << endl;
	cout << a << " * 1.25 = " << a * 1.25 << endl;
	cout << "Argument of " << b << " = " << b.argument() << endl;

	std::cout << "Press enter to exit." << std::endl;
	std::cin.get();
	return 1;
}

output

3+4i + 1-2i = 4+2i
3+4i - 1-2i = 2+6i
3+4i * 1-2i = 11-2i
3+4i / 1-2i = -1+2i
3+4i * 1.25 = 3.75+5i
Argument of 1-2i = -1.10715
Press enter to exit.

About

A c++ library for complex calculations

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages