#include <iostream> 
using namespace std;
#include "basicperson.h"
#include "aperson.h"
#include <fstream> 

class node
{
public:
	friend class list;//
	node(){number=0;
	anotherNode=NULL;
	anotherNodeBack=NULL;}
	~node(){};
	 void setNode_data(basicperson* new_person)
	{ person_data = new_person; }	
	basicperson* getNode_data()const{if(person_data)return person_data;
	                                        else return NULL;}
	void point_at_next(node* where_to_point)
	{anotherNode=where_to_point;}
	void point_at_previous(node* where_to_point)
	{anotherNodeBack=where_to_point;}
	node* getNext()const{return anotherNode;}
	node* getPrev()const{return anotherNodeBack;}
	void getPrint()const{person_data->display();}
private://protected:
	node* anotherNode;
	node* anotherNodeBack;
	int number;

    basicperson* person_data;
	//basicperson* person_data_back;
};
class list //:public node ,public aperson
{
public:
	list(){currentDL = NULL;};
	~list(){};
    void add_person_at_endDL();
	void add_animal_at_startDL();
	void add_animal_at_endDL();
    void move_currentDL_on();
    void move_currentDL_back();
    void delete_start_node();
    void delete_end_node();
    void modify_current();
	void modify_current_animal();
    void add_person_after_current();
	void add_animal_after_current();
    void delete_currentDL1();
	void add_person_at_startDL();
	void display_list();
    void print_list();
    void Erase_print_list();
private:
	node* temp ;	
	node* currentDL ;	
 };
void list:: add_person_at_startDL()
{
	aperson* new_person = new aperson;
	node* temp1 = new node;
	cout << endl<< " Name of the person : ";
	char x[25];cin >> x;
	cout << " Number : "; int y = 1;

	cin >> y;
	if(cin.fail()) //if the user enter a letter instead of a number
	{
	while(!(cin >> y))//a nested "while" within the "if" statement , else
	    {             //the user had to type twice the number
          cin.clear();
		  cin.ignore(INT_MAX,'\n');
		  cout << " Enter a number :\n";
		  if(!(cin >> y))cin >> y;
		  else {cin.ignore(); cout << " OK! \n"; break;}
         }
    }


	cout << " Title : ";char z[25];cin >>z;cout<< endl;
    new_person->init_data(x,y,z);
	temp1->setNode_data( new_person );
	if(currentDL == NULL){ currentDL = temp1;currentDL->point_at_next(NULL);
	currentDL->point_at_previous(NULL);}
	else {node* temp2 = currentDL;// declare a temporary pointer which will be at the beginning
		while ( temp2->getPrev()!=NULL )
			temp2= temp2->getPrev();
		node* temp3 = new node;
		temp3->setNode_data(new_person);
		temp3->point_at_previous(NULL);
        temp3->point_at_next(temp2);
		temp2->point_at_previous(temp3);
	    currentDL = temp3;
	      }
		cout << " v current person "<< endl;//delete temp1;
}
void list:: add_animal_at_startDL()
{
	animal* new_animal = new animal;
	node* temp1 = new node;
	
	//char xs[25]; // the first cin.getline didn't work so I have added an other before 
	//cout << endl<< " ";
	cin.ignore();//cin.getline(xs,25);

	char xt[25]; // the second works ...
	cout << " Name of the animal : ";
	cin.getline(xt,25);

	char ya[25];
	cout << " Number : ";
	cin.getline(ya,25);
	int y; y = atoi(ya);

	char z[25];
	cout << " Title : ";
	cin.getline(z,25);

	char xa[25];
	cout << " Comments : "<< endl;
	cin.getline (xa,25);cout<< endl;

    new_animal->init_data_animal(xt,y,z,xa);
	temp1->setNode_data( new_animal );
	if(currentDL == NULL){ currentDL = temp1;currentDL->point_at_next(NULL);
	currentDL->point_at_previous(NULL);}
	else {node* temp2 = currentDL;// declare a temporary pointer which will be at the beginning
		while ( temp2->getPrev()!=NULL )
			temp2= temp2->getPrev();
		node* temp3 = new node;
		temp3->setNode_data(new_animal);
		temp3->point_at_previous(NULL);
        temp3->point_at_next(temp2);
		temp2->point_at_previous(temp3);
	    currentDL = temp3;
	      }
		cout << " v current animal "<< endl;
		node* temp4;
	temp4 = currentDL;
	while(temp4->getPrev() != NULL){temp4 =temp4->getPrev();}
	do{temp4->person_data->display();
	temp4 = temp4->getNext();}while(temp4 != NULL);
}
void list:: display_list()
{
	node* temp1;
	temp1 = currentDL;
	while(temp1->getPrev() != NULL){temp1 =temp1->getPrev();}
	do{
	temp1->person_data->display();
	temp1 = temp1->getNext();}while(temp1 != NULL);
}
void list:: add_person_at_endDL()
{   
	aperson* new_person = new aperson;
	node* temp1 = new node;
	cout << endl<< " Name of the person : ";
	char x[25];cin >> x;
	cout << " Number : ";
	int y; cin >> y;
	
	if(cin.fail()) //if the user enter a letter instead of a number
	{
	while(!(cin >> y))//a nested "while" within the "if" statement , else
	    {             //the user had to type twice the number
          cin.clear();
		  cin.ignore(INT_MAX,'\n');
		  cout << " Enter a number :\n";
		  if(!(cin >> y))cin >> y;
		  else {cin.ignore(); cout << " OK! \n"; break;}
         }
    }


	cout << " Title : ";char z[25];cin >>z;cout<< endl;
    new_person->init_data(x,y,z);
	temp1->setNode_data( new_person );    
	
	if(currentDL==NULL ){
		currentDL = new node;
		currentDL = temp1;
		currentDL->point_at_next(NULL);
		currentDL->point_at_previous(NULL);
                        }	   
	else {
       node* temp2 = currentDL;
	   while ( temp2->getNext()!=NULL )
			temp2= temp2->getNext();
        node* temp3 = new node;
		temp3->setNode_data(new_person);
		temp3->point_at_previous(temp2);
        temp3->point_at_next(NULL);
		temp2->point_at_next(temp3);	    
		//printing the result on screen;
		node* tp1 = temp2;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();		
	cout << endl;
    node* w = currentDL; // new node equal the node before the last node for placing currentDL
	while(w->getNext()!=NULL)
		 w = w->getNext();
	    w = w->getPrev();
	currentDL = tp1; 
	node* temp4;
	temp4 = currentDL;
	while(temp4->getPrev() != NULL)
	{temp4 =temp4->getPrev();}
	do{temp4->person_data->display();
	if( temp4 == w ) // use node w for placing currentDL
		 cout << " v Current node "<< endl;
	temp4 = temp4->getNext();
	  }while(temp4 != NULL);
	currentDL = temp3;
	  }//end else
}
void list:: add_animal_at_endDL()
{   
	animal* new_animal = new animal;
	node* temp1 = new node;
	
	cin.ignore();//ignore remaining characters so that cin.getline will work

	char xt[25]; 
	cout << " Name of the animal : ";
	cin.getline(xt,25);

	char ya[25];
	cout << " Number : ";
	cin.getline(ya,25);
	int y; y = atoi(ya);

	char z[25];
	cout << " Title : ";
	cin.getline(z,25);

	char xa[25];
	cout << " Comments : "<< endl;
	cin.getline (xa,25);cout<< endl;

    new_animal->init_data_animal(xt,y,z,xa);
	temp1->setNode_data( new_animal );
	  
	
	if(currentDL==NULL ){
		currentDL = new node;
		currentDL = temp1;
		currentDL->point_at_next(NULL);
		currentDL->point_at_previous(NULL);
		cout << " v current animal "<< endl;
		node* temp4;
	temp4 = currentDL;
	do{temp4->person_data->display();
	temp4 = temp4->getNext();}while(temp4 != NULL);
                        }	   
	else {
       node* temp2 = currentDL;
	   while ( temp2->getNext()!=NULL )
			temp2= temp2->getNext();
        node* temp3 = new node;
		temp3->setNode_data(new_animal);
		temp3->point_at_previous(temp2);
        temp3->point_at_next(NULL);
		temp2->point_at_next(temp3);	    
		//printing the result on screen;
		node* tp1 = temp2;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();		
	cout << endl;
    node* w = currentDL; // new node equal the node before the last node for placing currentDL
	while(w->getNext()!=NULL)
		 w = w->getNext();
	    w = w->getPrev();
	currentDL = tp1; 
	node* temp4;
	temp4 = currentDL;
	while(temp4->getPrev() != NULL)
	{temp4 =temp4->getPrev();}
	do{temp4->person_data->display();
	if( temp4 == w ) // use node w for placing currentDL
		 cout << " v Current animal "<< endl;
	temp4 = temp4->getNext();
	  }while(temp4 != NULL);
	currentDL = temp3;
	  }//end else
}
void list:: modify_current_animal()
{   
	animal* new_animal = new animal;
	
	
	char xs[25]; // the first cin.getline didn't work so I have added an other before 
	cout << endl<< " ";
	cin.getline(xs,25);

	char xt[25]; // the second works ...
	cout << " Name of the animal : ";
	cin.getline(xt,25);

	char ya[25];
	cout << " Number : ";
	cin.getline(ya,25);
	int y; y = atoi(ya);

	char z[25];
	cout << " Title : ";
	cin.getline(z,25);

	char xa[25];
	cout << " Comments : "<< endl;
	cin.getline (xa,25);cout<< endl;

    new_animal->init_data_animal(xt,y,z,xa);
	currentDL->setNode_data( new_animal );
	
	node* w = currentDL; 
	node* tp1 = currentDL;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();	
	
	cout << endl;
   	
    while (tp1->getNext()!= 0)
	{ 
	if( tp1== w ) // use node w for placing currentDL
		cout << " v Current animal "<< endl;	
	tp1->person_data->display();
	tp1 = tp1->getNext();
	if( tp1== w ) // use node w for placing currentDL
		 cout << " v Current animal"<< endl;
	} 
	
	tp1->person_data->display();
	
}
void list:: add_animal_after_current()
{	if( currentDL->getNext() == NULL )
        add_animal_at_endDL();
    else  
	   {
    animal* new_animal = new animal;
	
	
	char xs[25]; // the first cin.getline didn't work so I have added an other before 
	cout << endl<< " ";
	cin.getline(xs,25);

	char xt[25]; // the second works ...
	cout << " Name of the animal : ";
	cin.getline(xt,25);

	char ya[25];
	cout << " Number : ";
	cin.getline(ya,25);
	int y; y = atoi(ya);

	char z[25];
	cout << " Title : ";
	cin.getline(z,25);

	char xa[25];
	cout << " Comments : "<< endl;
	cin.getline (xa,25);cout<< endl;

    new_animal->init_data_animal(xt,y,z,xa);
	currentDL->setNode_data( new_animal );
		node* temp5 = currentDL->getNext();
		node* temp6 = new node;
	    temp6->setNode_data( new_animal );
		temp6->point_at_next(temp5);
		temp6->point_at_previous(currentDL);
        temp5->point_at_previous(temp6);
		currentDL->point_at_next(temp6);
	    
	    currentDL = currentDL->getNext();

	    node* tp = currentDL;
	    while ( tp->getPrev() != NULL ) tp = tp->getPrev();

	    do{	
	    if ( currentDL==tp )
	    cout << " v Current animal "<< endl;
	    tp->person_data->display();
	    tp = tp->getNext();	
	    }while (tp != NULL);

       }	  
}


void list:: move_currentDL_on()
{
	if( currentDL->getNext()==NULL)
		cout <<" You are at the end of the list ! "<< endl;

	else {currentDL = currentDL->getNext();}

	node* tp = currentDL;
	while ( tp->getPrev() != NULL ) tp = tp->getPrev();

	do{	
	if ( currentDL==tp )
	cout << " v Current node "<< endl;
	tp->person_data->display();
	tp = tp->getNext();	
	}while (tp != NULL);

	if( currentDL->getNext()==NULL)
		cout <<" You are at the end of the list ! "<< endl;
}
void list:: move_currentDL_back()
{
	if( currentDL->getPrev()==NULL)
		cout <<" You are at the beginning of the list ! "<< endl;
	else {currentDL = currentDL->getPrev();}
	node* tp = currentDL;
	while ( tp->getPrev() != NULL ) tp = tp->getPrev();
	do{	
	if ( currentDL==tp )
	cout << " v Current node "<< endl;
	tp->person_data->display();
	tp = tp->getNext();
	
	}while (tp != NULL);
	if( currentDL->getNext()==NULL)
		cout <<" You are at the end of the list ! "<< endl;
}

void list:: delete_start_node()
{ 		
	while ( currentDL->getPrev()!= NULL )
      currentDL = currentDL->getPrev();
    if( currentDL->getNext()!= NULL )
	{
	  node* temp1 = currentDL;
	  currentDL = currentDL->getNext();
	  currentDL->point_at_previous(NULL);
      delete temp1;
	  node* temp2;
	temp1 = currentDL;
	while(temp2->getPrev() != NULL){temp2 =temp2->getPrev();}
	cout << " v current person "<< endl;
	do{temp2->person_data->display();
	temp2 = temp2->getNext();}while(temp2 != NULL);
	}
	else 
	{	
	  node* temp2 = currentDL;
      currentDL = NULL;
	  delete temp2 ;
	  cout << " List is empty now ! "<< endl;
	   
	}
    
	  
}
void list:: delete_end_node()
{ 		
	while ( currentDL->getNext()!= NULL )
      currentDL = currentDL->getNext();
    if( currentDL->getPrev()!= NULL )
	{
	  node* temp1 = currentDL;
	  currentDL = currentDL->getPrev();
	  currentDL->point_at_next(NULL);
      delete temp1;
	  node* w = new node; // new node for locating where is currentDL 
	  w = currentDL;
	node* temp3 = currentDL;
	node* tp1 = temp3;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();		
	cout << endl;

    while (tp1->getNext()!= 0)
	{ 	
	tp1->person_data->display();
	tp1 = tp1->getNext();
	if( tp1 == w ) // use node w for placing currentDL
		 cout << " v Current node "<< endl;
	} 
	
	tp1->person_data->display();
	currentDL = tp1;
	}
	else 
	{	
	  node* temp2 = currentDL;
      currentDL = NULL;
	  delete temp2 ;
	  cout << " List is empty now ! "<< endl;	   
	}	  
}
void list:: modify_current()
{   
	aperson* new_person = new aperson;
	cout << endl<< " New name of the person : ";
	char x[25];cin >> x;
	cout << " New number : "; 
	int y;cin >> y;
	
	if(cin.fail()) //if the user enter a letter instead of a number
	{
	while(!(cin >> y))//a nested "while" within the "if" statement , else
	    {             //the user had to type twice the number
          cin.clear();
		  cin.ignore(INT_MAX,'\n');
		  cout << " Enter a number :\n";
		  if(!(cin >> y))cin >> y;
		  else {cin.ignore(); cout << " OK! \n"; break;}
         }
    }

	cout << " New title : ";char z[25];cin >>z;cout<< endl;
    new_person->init_data(x,y,z);
	currentDL->setNode_data( new_person );
	node* w = currentDL; 
	node* tp1 = currentDL;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();	
	
	cout << endl;
   	
    while (tp1->getNext()!= 0)
	{ 
	if( tp1== w ) // use node w for placing currentDL
		cout << " v Current node "<< endl;	
	tp1->person_data->display();
	tp1 = tp1->getNext();
	if( tp1== w ) // use node w for placing currentDL
		 cout << " v Current node "<< endl;
	} 
	
	tp1->person_data->display();
	
}

void list:: add_person_after_current()
{	if( currentDL->getNext() == NULL )
        add_person_at_endDL();
    else  
	   {
		node* temp5 = currentDL->getNext();
		node* temp6 = new node;
		aperson* new_person = new aperson;
	    cout << endl<< " Name of the person : ";
	    char x[25];cin >> x;
	    cout << " Number : ";
		int y;cin >> y;
		
		if(cin.fail()) //if the user enter a letter instead of a number
	      {
	       while(!(cin >> y))//a nested "while" within the "if" statement , else
	           {             //the user had to type twice the number
                 cin.clear();
		         cin.ignore(INT_MAX,'\n');
		         cout << " Enter a number :\n";
		         if(!(cin >> y))cin >> y;
		         else {cin.ignore(); cout << " OK! \n"; break;}
               }
          }

	    cout << " Title : ";char z[25];cin >>z;cout<< endl;
        new_person->init_data(x,y,z);
	    temp6->setNode_data( new_person );

		temp6->point_at_next(temp5);
		temp6->point_at_previous(currentDL);
        temp5->point_at_previous(temp6);
		currentDL->point_at_next(temp6);
	    
	    currentDL = currentDL->getNext();

	    node* tp = currentDL;
	    while ( tp->getPrev() != NULL ) tp = tp->getPrev();

	    do{	
	    if ( currentDL==tp )
	    cout << " v Current node "<< endl;
	    tp->person_data->display();
	    tp = tp->getNext();	
	    }while (tp != NULL);

       }	  
}


void list:: delete_currentDL1()
{

if(currentDL->getPrev()!= NULL )
{
	node* temp1 = new node;
	node* temp2 = new node;
	temp1 = currentDL->getPrev();
	if( currentDL->getNext()!= NULL ) 
	{temp2 = currentDL->getNext();
	delete currentDL; }
	else 
	{temp2 = NULL;
	delete currentDL;}
	temp1->point_at_next(temp2);
	
	if( temp2!= NULL ) 
	{temp2->point_at_previous(temp1);
	node* currentDL = temp2;}
	else {node* currentDL = temp1;}
          //printing the result on screen :
	node* w = new node; // new node for locating where is currentDL 
	if( temp2!= NULL )  w = temp2; 
	else  w = temp1;
	node* tp1 = temp1;
    while( tp1->getPrev()!= NULL ) tp1 = tp1->getPrev();	
	
	cout << endl;
   
	
    while (tp1->getNext()!= 0)
	{ 	
	tp1->person_data->display();
	tp1 = tp1->getNext();
	if( tp1 == w ) // use node w for placing currentDL
		 cout << " v Current node "<< endl;
	} 
	
	tp1->person_data->display();
	currentDL = tp1;
}

else delete_start_node();


	

	
}
void list:: print_list()
{
	if(currentDL==NULL)
		cout << "******* List is empty !******* \n";
	else
	{
	node* temp1;
	temp1 = currentDL;
	while(temp1->getPrev() != NULL){temp1 =temp1->getPrev();}
	do{
	temp1->person_data->print_list();
	temp1 = temp1->getNext();}while(temp1 != NULL);
	}
}

void list:: Erase_print_list()
{
	if(currentDL==NULL)
		cout << "******* List is empty !******* \n";
	else
	{
	node* temp1;
	temp1 = currentDL;
	while(temp1->getPrev() != NULL){temp1 =temp1->getPrev();}
	do{
	temp1->person_data->erase_print_list();
	temp1 = temp1->getNext();}while(temp1 != NULL);
	}
}

int main()
{
	list* LL = new list;
	int option = 0;
	
	do{
	cout << endl<< " Select an option : "<< endl;		            
	cout << "\n 0 Exit the program \t\t"<<
		           " 10 Add animal at start DL "<< endl;
	cout << " 1 Add person at start DL \t"<<
		           " 11 Add animal at end DL "<< endl;
    cout << " 2 Add person at end DL \t"<<
		           " 12 Modify current animal "<< endl;
    cout << " 3 Move current  on \t\t"<<
		           " 13 Add animal after current "<< endl;
	cout << " 4 Move current  back "<< endl;
	cout << " 5 Delete first  "<< endl;
    cout << " 6 Delete end  "<< endl;
	cout << " 7 Modify current person "<< endl;
	cout << " 8 Add person after current "<< endl;
	cout << " 9 Delete current  "<< endl << endl; 
	cout << " 14 Print list "<< endl;
	cout << " 15 Erase printed list "<< endl;
	//try
	//{
	cin >> option;	
	switch(option)
	{
	case 0 : return 0; //and the second zero (typed by the user) ends the program !
	case 1 : LL->add_person_at_startDL(); LL->display_list();break;		
    case 2 : LL->add_person_at_endDL();break;
	case 3 : LL->move_currentDL_on();break;
	case 4 : LL->move_currentDL_back();break;
	case 5 : LL->delete_start_node();break;
	case 6 : LL->delete_end_node();break;
	case 7 : LL->modify_current();break;
	case 8 : LL->add_person_after_current();break;
	case 9 : LL->delete_currentDL1();break;
	case 10 :LL->add_animal_at_startDL();break;
	case 11 :LL->add_animal_at_endDL();break;
	case 12 :LL->modify_current_animal();break;
	case 13 :LL->add_animal_after_current();break;
	case 14 :LL->print_list();break;
	case 15 :LL->Erase_print_list();break;
	}
	}while (option!=0);
	//}// end of try block
	//catch(... )
	//{
		//cout << "\n****** nb ****** " << endl;
	//}
	
	
	getchar();
	char ze;
	cin >> ze;
}
    

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