diff options
author | Santo Cariotti <sancn@live.com> | 2017-04-27 15:26:45 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-04-27 15:26:45 +0200 |
commit | 0ac2603ae4c097e9c0e3915d96cc96387f186f19 (patch) | |
tree | 090bd09c191ae7249490374aa24351caf80305b6 | |
parent | 750b7dc56161470c91caf051add98cad4146bf30 (diff) |
Deleted files
-rw-r--r-- | cpp/Es 3.cpp | 109 | ||||
-rw-r--r-- | cpp/Es5.cpp | 46 | ||||
-rw-r--r-- | cpp/Es6.cpp | 38 | ||||
-rw-r--r-- | cpp/arrayMinMax.cc | 35 | ||||
-rw-r--r-- | cpp/ascensore.cc | 90 |
5 files changed, 0 insertions, 318 deletions
diff --git a/cpp/Es 3.cpp b/cpp/Es 3.cpp deleted file mode 100644 index d525f62..0000000 --- a/cpp/Es 3.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include <iostream>
-#define BIANCO 0 //Non Visitato
-#define NERO 2 //Visitato
-#define GRIGIO 1 //Non Finito
-#define INF 999999
-#include <vector>
-#include <fstream>
-#include <queue>
-#define MAXN 9999
-#define INDEF -1
-#include <stack>
-using namespace std;
-typedef pair <int,int> p;
-std::priority_queue<p, std::vector<p>, std::greater<p> > Q;
-int V,E;
-int matriceAdj[MAXN][MAXN];
-int T;
-struct nodo {
- vector <int> adj;
- int inizio,fine;
-}no[MAXN];
- int colore[MAXN];
- bool Ciclico=false;
- bool dfsVisit (int u)
- {
- cout<<u<<endl;
- colore[u]= GRIGIO;
- int inizio=++T;
- no[u].inizio=inizio;
- int a;
- for (int i=0;i<no[u].adj.size();i++)
- {
- a=no[u].adj[i];
- if (colore[a]==GRIGIO)
- {
- Ciclico=true;
- return 1;
- }
- if ( colore[a] == BIANCO )
- {
- int b=dfsVisit(a);
- if (b)
- {
- return 1;
- }
- }
- }
- colore[u]= NERO;
- int fine=++T;
- no[u].fine=fine;
- Q.push(p(fine,inizio));
- return 0;
- }
-
- void dfsVisit2 (int u)
- {
- cout<<u<<endl;
- colore[u]= GRIGIO;
- int a;
- for (int i=0;i<no[u].adj.size();i++)
- {
- a=no[u].adj[i];
- if ( colore[a] == BIANCO )
- dfsVisit(a);
- }
- colore[u]= NERO;
- }
- // Le chiamate ricorsive sono quanti sono i nodi GRIGI
- void dfs()
- {
- for (int i=0;i<V;i++) colore[i]=BIANCO;
- for (int i=0;i<V;i++) if (colore[i]==BIANCO) if (dfsVisit(i)) return;
- }
-
-
-int main(int argc, char** argv) {
- ifstream in ("input.txt");
- ofstream out ("output.txt");
- in>>V>>E;
- int a,b;
- for (int i=0;i<E;i++)
- {
- in>>a>>b;
- no[a].adj.push_back(b);
- }
- dfs();
- for (int i=0;i<V;i++)
- {
- cout<<"nodo "<<i<<endl;
- cout<<"Inizio "<<no[i].inizio<<" Fine "<<no[i].fine<<endl;
- }
- if (!Ciclico)
- {
- for (int i=0;i<V;i++) colore[i]=BIANCO;
- b=0;
- while (!Q.empty())
- {
- a=Q.top().first;
- Q.pop();
- if (colore[a]==BIANCO)
- {
- dfsVisit2(a);
- b++;
- }
- }
- cout<<"Il numero di Componenti connesse e' "<<b;
- }
- return 0;
-}
diff --git a/cpp/Es5.cpp b/cpp/Es5.cpp deleted file mode 100644 index 8f6fb48..0000000 --- a/cpp/Es5.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <iostream>
-#define BIANCO 0 //Non Visitato
-#define NERO 2 //Visitato
-#define GRIGIO 1 //Non Finito
-#define INF 999999
-#include <vector>
-#include <fstream>
-#include <queue>
-#define MAXN 9999
-#define INDEF -1
-#include <stack>
-using namespace std;
-typedef pair <int,int> p;
-struct nodo{
- vector<int> adj;
- vector<int> p;
-};
-
-int main(int argc, char** argv) {
- int v,e;
- int sorgente;
- nodo no[v];
-
- priority_queue<p> Q;
- int peso[v];
- Q.push(p(0,sorgente));
-
- while(!Q.empty())
- {
- pair <int,int> a=Q.top();
- Q.pop();
- if (a.first > peso[a.second])
- continue;
-
- for (int i=0;i<no[a.second].adj.size();i++)
- {
- if (peso[no[a.second].adj[i]]>a.first+ no[a.second].p[i])
- {
- peso[no[a.second].adj[i]]=a.first + no[a.second].p[i];
- Q.push(p(peso[no[a.second].adj[i]],no[a.second].adj[i]));
- }
- }
-
- }
- return 0;
-}
diff --git a/cpp/Es6.cpp b/cpp/Es6.cpp deleted file mode 100644 index 9907eb9..0000000 --- a/cpp/Es6.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <iostream>
-#include <algorithm>
-using namespace std;
-/* run this program using the console pauser or add your own getch, system("pause") or input loop */
-
-int main(int argc, char** argv) {
- int v=5;
- int matrice[v][v];
- for (int i=0;i<v;i++)
- {
- for (int j=0;j<v;j++)
- matrice[i][j]=9999;
- }
- for (int i=1;i<v;i++) matrice[i][i]=0;
- matrice[1][4]=5;
- matrice[1][2]=1;
- matrice[2][3]=2;
- matrice[3][1]=2;
- matrice[3][4]=1;
- matrice[4][1]=3;
- for (int h=1;h<v;h++)
- {
- for (int i=1;i<v;i++)
- {
- for (int j=1;j<v;j++)
- {
- matrice[i][j]=min(matrice[i][j],matrice[i][h]+matrice[h][j]);
- }
- }
- }
- for (int i=1;i<v;i++)
- {
- for (int j=1;j<v;j++)
- cout<<matrice[i][j]<<" ";
- cout<<endl;
- }
- return 0;
-}
diff --git a/cpp/arrayMinMax.cc b/cpp/arrayMinMax.cc deleted file mode 100644 index be36903..0000000 --- a/cpp/arrayMinMax.cc +++ /dev/null @@ -1,35 +0,0 @@ -#include <iostream> - -using namespace std; - -int main(void) -{ - int a[] = {5,14,9,8,10,65,32,1,6,78}; - int tot = sizeof a / sizeof(int); - int t, i, j, minore = a[0], maggiore = a[tot-1]; - - for(i = 0; i < tot; i++) - { - for(j = 0; j < tot-1; j++) - { - if(a[j] > a[j+1]){ - t = a[j+1]; - a[j+1] = a[j]; - a[j] = t; - } - } - } - - //for(i = 0; i < tot; i++) cout << a[i] << endl; - - /*for(int i = 0; i < tot; i++) - { - if(a[i] < minore) minore = a[i]; - else if(a[i] > maggiore) maggiore = a[i]; - }*/ - - cout << minore << endl; - cout << maggiore << endl; - - return 0; -} diff --git a/cpp/ascensore.cc b/cpp/ascensore.cc deleted file mode 100644 index 8e69964..0000000 --- a/cpp/ascensore.cc +++ /dev/null @@ -1,90 +0,0 @@ -#include <iostream> -#include <stdlib.h> -#include <string> -#include <unistd.h> - -class Ascensore -{ -private: - unsigned short int floor; - bool doors; - unsigned short int maxFloor; -public: - Ascensore(unsigned short int plan = 0) {floor = plan; maxFloor = 5;} - void Up(void); - void Down(void); - void Doors(void); - void getFloor(void); -}; - -void _clear(void); - -using namespace std; - -int main(void) -{ - char choose; - Ascensore *ascensore = new Ascensore(); - do { - ascensore->getFloor(); - cin >> choose; - choose = tolower(choose); - if(choose == 'u' || choose == 'd') ascensore->Doors(); - sleep(2); - switch(choose) - { - case 'u' : ascensore->Up(); break; - case 'd' : ascensore->Down(); break; - case 'e' : break; - } - _clear(); - if(choose == 'u' || choose == 'd') ascensore->Doors(); - } while(choose != 'e'); - - cout << "SEI USCITO DALL'ASCENSORE CON SUCCESSO!"; - - return 0; -} - -void _clear(void) -{ - #ifdef OS_WINDOWS - system("CLS"); - #else - system("clear"); - #endif -} - -void Ascensore::getFloor(void) -{ - if(floor == maxFloor) cout << "Sei arrivato all'ultimo piano" << endl; - if(floor == 0) cout << "Non puoi scendere più di così" << endl; - cout << "SEI ATTUALMENTE AL PIANO " << floor << endl; - cout << "\nQUALE AZIONE SI VUOLE COMPIERE?" << endl; - cout << "U - salire" << endl; - cout << "D - scendere" << endl; - cout << "E - Uscire" << endl; - cout << "> "; -} - -void Ascensore::Up(void) -{ - if(floor < maxFloor) floor+=1; -} - -void Ascensore::Down(void) -{ - if(floor > 0) floor-=1; -} - -void Ascensore::Doors(void) -{ - if(doors == true) - { - cout << "> APERTURA PORTE" << endl; - doors = false; - } else { - cout << "> CHIUSURA PORTE..." << endl; - doors = true; - } -} |