// two-qubit state and operations // // #ifndef Q2_H_ // #define Q2_H_ class Q2 { private: double a00, a01, a10, a11; public: Q2(); void print(const char msg[]) const; }; // #endif // Q2_H_ // two-qubit state and operations // #include // #include "Q2.h" using namespace std; Q2::Q2() { a00 = 1; a01 = a10 = a11 = 0; } void Q2::print(const char msg[]) const { cout << msg << ":" << endl; cout << " 00 " << a00*a00 << " (" << a00 << ")" << endl; cout << " 01 " << a01*a01 << " (" << a01 << ")" << endl; cout << " 10 " << a10*a10 << " (" << a10 << ")" << endl; cout << " 11 " << a11*a11 << " (" << a11 << ")" << endl; } // test Q2 // #include // #include "Q2.h" using namespace std; int main() { Q2 q; q.print("q"); }