.
#include<iostream>
#include<vector>
#include<ostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
using namespace std;

class Vect_op;

typedef vector<double>Vect;
typedef vector<Vect>Matr;
typedef vector<Vect_op>Matr_op;//a matrix which contain vectors Vect_op 

Matr EnterMatrix();
void PrintMatrix(Matr a);
int fact(int a);
Matr InvertMatrix(Matr a);

class Vect_op// a class for overloading the operators so that I can add multiply etc.. these vectors
{
public:
	Vect_op()
	{
		Vect a;
		for(int i = 0; i < 3; i++)
			a.push_back(0); 
		itsVect = a;
    }
	Vect_op(Vect& a){ itsVect = a;}//copyctor
	~Vect_op(){};
	void setVect(const Vect& a){ itsVect = a;}
	Vect getVect(){ return itsVect;}
	
	Vect_op operator+(const Vect_op& a)
	{
		Vect b = a.itsVect;
		Vect c = a.itsVect;
		for(int i = 0; i < b.size(); i++)
			c[i] = itsVect[i] + b[i];
		Vect_op z(c);
		return z;
	}
	Vect_op operator-(const Vect_op& a)
	{
		Vect b = a.itsVect;
		Vect c = a.itsVect;
		for(int i = 0; i < b.size(); i++)
			c[i] = itsVect[i] - b[i];
		Vect_op z(c);
		return z;
	}
	double operator*(const Vect_op& a)
	{
		Vect b = a.itsVect;
		double res = 0;
		for(int i = 0; i < b.size(); i++)
			res += (itsVect[i] * b[i]);
		return res;
	}
	Vect_op operator*(const double& x)
	{
		Vect b = itsVect;
		for(int i = 0; i < b.size(); i++)
			b[i] *= x;
		Vect_op w(b);
		return w;
	}
	double operator[](int x)
	{
		Vect b = itsVect;
		return b[x];
	}

	double sq_norm()
	{
		double res = 0;
		for(int i = 0; i < itsVect.size(); i++)
			res += (itsVect[i] * itsVect[i]);
		return res;
	}
	friend
	ostream& operator<<( ostream& xout, const Vect_op& v)
	{
		Vect a = v.itsVect;
		for(int i = 0; i < a.size(); i++)
		{
			xout << " element [" << i << "] = " << a[i] << endl;
		}
		return xout;
	}
	Matr_op setMatr_op( Matr a)//a function for turning an ordinary matrix into a matrix filled with vectors Vect_op
	{
		Matr_op b;
		for(int i = 0; i < a.size(); i++)
		{
			Vect_op v(a[i]);
			b.push_back(v);
		}
		return b;
	}
	Matr getMatr( Matr_op a)
	{
		Matr b;
		Vect v;
		for(int i = 0; i < a.size(); i++)
		{
			v = a[i].getVect();
			b.push_back(v);
		}
		return b;
	}


	
private:
	Vect itsVect;
};

int main()
{
	

	Vect a1;
	Vect b;
	Vect c;
	double x;
	a1.push_back(3);
	a1.push_back(7);
	a1.push_back(-2);
	b.push_back(5);
	b.push_back(-4);
	b.push_back(10);
	Vect_op v(a1);
	Vect_op w(b);
	x = v * w;
	cout << x << endl;
	Vect_op y(a1);
	y = v * x;
	c = y.getVect();
	for(int i = 0; i < c.size(); i++)
	{
		cout << " element " << i << " = " << c[i] << endl;
	}
	double z = w.sq_norm();
	cout << " squared norm of w = " << z << endl;
	Vect_op u(a1);
	u = v + w;
	c = u.getVect();
	for(int i = 0; i < c.size(); i++)
	{
		cout << " element " << i << " = " << c[i] << endl;
	}

	cout << v[1] << endl;
	cout << w << endl;
	cout << u << endl;
	
	int i;
	int counter = 0;
	int nb = 0;
	cout << " number of rows or columns :\n";
	cin >> nb;
	
	cout << " Enter the square matrix :\n";
	Vect row(nb);
	Vect determinant;
	Matr a;
	int product = 1;
	int determ = 0;
	int ve1 = 0;

	for(i = 0; i < nb; i++)
	{
		for(int j = 0; j < nb; j++)
		{
			if(j<(nb-1))
				cout << " enter element\n";
			else cout << " enter last element of this row\n";
			cin >> row[j];
		}
		a.push_back(row);
	}
	
	for(i = 0; i < nb; i++)
	{
		cout << endl;
		for(int j = 0; j < nb; j++)
		{
			cout << a[i][j] << " ";
		}
	}
	cout << endl;



	vector<int>vec;
	for(i = 1; i <= nb; i++)
		vec.push_back(i);
	vector<int>::iterator iter1 = vec.begin();
	vector<int>::iterator iter2 = vec.end();


	for(i = 0; i < fact(nb); i++)
	{
		 /* copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, " "));;*/
		  vector<int>vec1(nb);
		  copy(vec.begin(), vec.end(), vec1.begin());
		  for(int j = 0; j < (nb); j++)
			  cout << vec1[j];
		  for(int i = 0; i < vec1.size(); i++)
		  {
			
			  for(int j = i; j < vec1.size(); j++)
			  {
				  if(vec1[j]<vec1[i])
					  counter++;
			  }
		  }
		  if(counter%2==0)
			  cout << " even ";
		  else 
			  cout << " odd ";
		  
		  
		  for(int w = 0; w < nb; w++)
		  {
			  ve1 = (vec1[w])-1;
			  product *= (a[w][ve1]);
		  }	
		  if(counter%2!=0)
			  product = (- product);

		  determinant.push_back(product); 

          counter = 0;
		  product = 1;
		  next_permutation(iter1, iter2);
		  cout << endl;
	}
	
	for(int x = 0; x < determinant.size(); x++)
	{
		determ += determinant[x];
	}
	
	for(i = 0; i < nb; i++)//print the matrix
	{
		cout << endl;
		for(int j = 0; j < nb; j++)
		{
			cout << a[i][j] << " ";
		}
	}
	cout << endl;


	cout << " The determinant is :\n";
	cout << determ << endl;
	if(determ!=0) cout << " determinant is not zero \n";
	else cout << " determinant equal zero : no QR decomposition possible\n";

	Matr e;
	Vect d;
	for(int j = 0; j < (a[0].size()); j++)
	{
		for(int i = 0; i < a.size(); i++)
		{
			d.push_back(a[i][j]);
		}
		e.push_back(d);
		d.clear();		
	}
	

	Vect row1; 
	Matr q,f;
	for(int i = 0; i < a.size(); i++)
	{
		for(int j = 0; j < a.size(); j++)
		{
			row1.push_back(0);
		}
		q.push_back(row1);
		f.push_back(row1);
	 }
	Matr_op qz, fz, ez;
	qz = v.setMatr_op(q);
	fz = v.setMatr_op(f);
	ez = v.setMatr_op(e);
    for(int i = 0; i < q.size(); i++)
	{
		for(int j =0; j < q.size(); j++)
		{
			
			if(i==0)
				qz[i] = ez[i];
			if(i!=0)
			{
				if(j==0) 
					fz[j].setVect(f[0]);
			    if(j!=0)
			    {
				    fz[j] =   fz[j-1] + ( qz[j-1] * ( ez[i] * qz[j-1] ))* ( 1 / qz[j-1].sq_norm() );
					if(j==i) 
					{
						qz[i] = ez[i] - fz[j];
						j = q.size();
					}
			    }
			}
		}
		fz = v.setMatr_op(f);
	}
    Matr qw;
	qw = v.getMatr(qz);
	

	//turn the vectors of qw into an orthonormal basis ( they are only orthogonals...)
	for(int i = 0; i < qz.size(); i++)
	{
		double n = qz[i].sq_norm();
		n = sqrt(n);
		Vect ort; double w;
		for(int j =0; j < (qz[0].getVect()).size(); j++)
		{
			w = (qz[i].getVect())[j] /=  n;
			ort.push_back(w);
		}
		qz[i].setVect(ort);
	}
	qw = v.getMatr(qz);
	
    //finding r the upper triangular matrix:
	Matr r = f;
	Matr_op rz;
	rz = v.setMatr_op(r);
	for(int i = 0; i < ez.size(); i++)
	{
		Vect tria; double w;
		for(int j =0; j < ez.size(); j++)
		{
			/*if(j<i)
			{
				w = ((rz[i]).getVect())[j] = 0;	
				tria.push_back(w);
			}
			else if(j>=i) */
			{
				w = ((rz[i]).getVect())[j] = ez[i] * qz[j];
				tria.push_back(w);
			}
		}
		rz[i].setVect(tria);
	}
	r = v.getMatr(rz);

	// put the Q and R matrices upside down...( qw and r ):
	Matr Q, R;
	Q = InvertMatrix(qw);
	R = InvertMatrix(r);
	cout << " \n The Q matrix is :\n";
	PrintMatrix(Q);
	cout << " \n The R matrix is :\n";
	PrintMatrix(R);




	return 0;
}
    Matr EnterMatrix()
	{
	    int nb1 = 0; 
		int nb2 = 0;
	    Matr a;	    
	    cout << " Number of rows\n";
	    cin >> nb1;
	    cout << " Number of columns\n";
	    cin >> nb2;
	    cout << " Enter the matrix :\n";
		Vect row(nb2);
	
	    for(int i = 0; i < nb1; i++)
	    {
		    for(int j = 0; j < nb2; j++)
		    {

			    if(j<(nb2-1))
				    cout << " enter element\n";
			    else cout << " enter last element of this row\n";
			    cin >> row[j];
		    }
		    a.push_back(row);
	     }
	     return a;
	}
	
    void PrintMatrix(Matr a)
	{
		int nb = a.size();
		int nb1 = (a[0].size());
		for(int i = 0; i < nb; i++)
	    {
		     cout << endl;
			 cout.width(1);
		     for(int j = 0; j < nb1; j++)
		     {
				 if((a[i][j])>0)
                     cout << setw(1) ;
				 //cout.width(5);<< " "<< " ";
			     cout << setw(14) << a[i][j] ;
				 //<< " "
		     }			 
	     }
	     cout << endl;
	}
	
   int fact(int a)
   {
	    if(a<=1)
		   return a;

	    return (a * fact(a - 1));
   }
   
   Matr InvertMatrix(Matr a)
   {
	   Matr e;
	   Vect d;
	   for(int j = 0; j < (a[0].size()); j++)
	   {
		  for(int i = 0; i < a.size(); i++)
		  {
			  d.push_back(a[i][j]);
		  }
		  e.push_back(d);
		  d.clear();		
	   }
	   return e;
   }

Doubly linked list (4 files)

C++ again, for finding one root of a third degree equation and checking the result , it often works fine :

For finding the 93 first Fibonacci numbers very fast , after 93 iterations it is false :

A linked list for practising :

For finding the binary representation of a number using bits :

For finding the binary representation of a number using maths :

hexadecimal representation of a number using maths :

hexadecimal representation of a number using bits :

for well understanding the structure of a linked list, here is a simple one:

It was a long and difficult linked list, but apparently, it works. Below are some other pages of code in C++, exercises most of the time. I have also put some of my plugins for 3dsmax.

I learned maxscript before learning C++, here are some scripts or plugins I did:

Next, there is some linear algebra and funny matrices:

This is now a script for enciphering and deciphering messages.

Here is an example of enciphered message. If I tell you that the 2 primes are 431 and 743 , with my script above you surely can translate the following message: 62520 172480 147764 226702 42110 58127 123996 256203 196716 181614 299597 181614 241357 187604 32762 17311 309478 29630 301116 153664 113777 14703

C++LANGUAGE
 
basicperson.h
aperson.h
aperson.cpp
ofstream.cpp
 
 
 
 
maxplugins
 
thirddegree.cpp
 
fibonacci.cpp
 
linkedlist.cpp
 
binary1
 
binary2
 
BACKHOME
 
hex1
 
hex2
 
simpleLinkedList
 
determinantmatrix
 
QRdecomposition
 
cryptography