Sviderka Darius
using namespace std;
#include<fstream>
#include<iostream>
int ta[50],tl[50],c[50][50],n;
void citire()
{int x,y,z,i;
ifstream fin("fisier.txt");
fin>>n;
while(fin>>x>>y>>z)
c[x][y]=z;
for(i=1;i<=n;i++)
ta[i]=tl[i]=0;
}
void formare()
{int i,j,max,min;
ta[1]=0;
for(i=2;i<=n;i++)
{max=0;
for(j=1;j<=n;j++)
if(c[j][i]>0)
if(max<ta[j]+c[j][i])
max=ta[j]+c[j][i];
ta[i]=max;
}
tl[n]=ta[n];
for(i=n-1;i>=1;i--)
{
min=999;
for(j=1;j<=n;j++)
if(c[i][j]>0)
if(min>tl[j]-c[i][j])
min=tl[j]-c[i][j];
tl[i]=min;
}
}
void afisare()
{int i,j;
cout<<"even critice=";
for(i=1;i<=n;i++)
if(ta[i]==tl[i])
cout<<i<<" ";
cout<<endl;
cout<<"act critica="<<endl;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(c[i][j]>0)
if((ta[i]==tl[i])&&(ta[j]==tl[j]))
if(ta[j]==ta[i]+c[i][j])
cout<<i<<" "<<j<<endl;
}
int main()
{ int i,j;
citire();
formare();
for(i=1;i<=n;i++)
{for(j=1;j<=n;j++)
cout<<c[i][j]<<" ";
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
cout<<ta[i]<<" ";
cout<<endl;
for(i=1;i<=n;i++)
cout<<tl[i]<<" ";
cout<<endl;
afisare();
return 0;
}
using namespace std;
# include <conio.h>
# include <iostream>
# include <math.h>
class dreptunghi
{
int l1,l2;
public:dreptunghi(int a,int b)
{l1=a;l2=b;}
dreptunghi(int a)
{l1=l2=a;}
dreptunghi(dreptunghi &d1)
{l1=d1.l1;l2=d1.l2;}
void intr_date()
{cout<<"lungimea=";cin>>l1;
cout<<"latimea=";cin>>l2;}
void afisare()
{cout<<"lungimea="<<l1;
cout<<"latimea="<<l2<<endl;}
};
class paralelipiped:public dreptunghi
{ int l3;
public:paralelipiped(int a):dreptunghi(int (a))
{l3=a;}
void intr_date()
{dreptunghi::intr_date();
cout<<"n inaltimea=";cin>>l3;}
void afisare()
{dreptunghi::afisare();
cout<<"ninaltimea="<<l3;}
};
int main()
{
dreptunghi d1(0,0),d2(5,6),d3(7);
cout<<"nIntrod. dimensiuni pt. d1";
d1.intr_date();
cout<<"nDimensiunile pt. d1:";
d1.afisare();
cout<<"nDimensiunile pt. d2:";
d2.afisare();
cout<<"nDimensiunile pt. d3:";
d3.afisare();
paralelipiped p1(4);
cout<<"nIntrod. dimensiuni pt. paralelipiped:";
p1.intr_date();
cout<<"nDimensiunile pt. p1:";
p1.afisare();
getch();
}