@JadenJoner/

Quantum-Simulator

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream> 
/* time example */
#include <stdio.h>
#include <time.h>


using namespace std;

const long double sysTime = time(0);
const long double sysTimeMS = sysTime*1000;

class q {
	public:

		void set(bool mode){
			value = mode;
		}
		void spin(){
			value = 2;
			save = ((int)sysTimeMS)%2;
		}
		bool stop(){
			value = save;
			return 0;
		}
		void print(){
			switch(value){
				case 0: cout << "off"; break;
				case 1: cout << "on"; break;
				case 2: cout << "spin"; break;
			}
			cout << "\n";
		}

	private:

		char value;
		bool save;
};

int main()
{
	q a;
	a.set(0);
	a.print();
	a.spin();
	a.print();
	a.stop();
	a.print();
	cout << ((int)sysTime)%2;

}