Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programare
#62
Uite ce facem noi la infoHaha!


#include <iostream>
#include <fstream>
using namespace std;

int main()
{
int a[101][101],aux,ok,max,m,n,i,j,p[101];
ifstream f("mat.in");
f>>n>>m;
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
f>>a[i][j];
f.close();
ofstream g("mat.out");
for(j=1;j<=n;j++)
{
p[j]=1;
for(i=1;i<=m;i++)
p[j]=p[j]*a[i][j];

}
max=p[1];
for(i=1;i<=n;i++)
if(max<p[i])
max=p[i];
for(i=1;i<=m;i++)
if(max==p[i])
cout<<i<<" ";
do{
ok=1;
for(j=1;j<n;j++)
if(a[1][j]>a[1][j+1])
{
aux=a[1][j];
a[1][j];
a[1][j+1]=aux;
ok=0;
}
}while(ok==0);
for(i=1;i<=n;i++)
{
cout<<endl;
for(j=1;j<=n;j++)
cout<<a[i][j]<<" ";
}
g.close();
return 0;
}


Deja mi s-a acrit de matriciSmile. Vectorii sunt mult mai faini si mai usori ca matricileSmile.
"Errare humanum est sed perseverare diabolicum."
"Gutta cavat lapidem non vi, sed saepe cadendo."
"Inter arma silent leges."

replyReply


Messages In This Thread
Programare - by Zamolxis1 - 10-14-2011, 07:49 PM
RE: Programare - by Szekemri - 10-14-2011, 07:53 PM
RE: Programare - by g3orge13 - 10-14-2011, 09:05 PM
RE: Programare - by Szekemri - 10-14-2011, 09:21 PM
RE: Programare - by Altair xD - 10-14-2011, 09:16 PM
RE: Programare - by g3orge13 - 10-14-2011, 09:18 PM
RE: Programare - by Altair xD - 10-14-2011, 09:21 PM
RE: Programare - by Altair xD - 10-14-2011, 09:23 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 05:42 PM
RE: Programare - by Szekemri - 10-15-2011, 05:56 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 06:46 PM
RE: Programare - by Szekemri - 10-15-2011, 07:04 PM
RE: Programare - by Altair xD - 10-15-2011, 07:49 PM
RE: Programare - by Szekemri - 10-15-2011, 08:04 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:01 PM
RE: Programare - by Szekemri - 10-15-2011, 08:09 PM
RE: Programare - by Altair xD - 10-15-2011, 08:06 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:10 PM
RE: Programare - by Szekemri - 10-15-2011, 08:12 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:17 PM
RE: Programare - by Szekemri - 10-15-2011, 08:24 PM
RE: Programare - by Altair xD - 10-15-2011, 08:25 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:28 PM
RE: Programare - by Szekemri - 10-15-2011, 08:33 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:37 PM
RE: Programare - by Szekemri - 10-15-2011, 08:39 PM
RE: Programare - by Zamolxis1 - 10-15-2011, 08:40 PM
RE: Programare - by Altair xD - 10-16-2011, 03:22 PM
RE: Programare - by Szekemri - 10-16-2011, 04:05 PM
RE: Programare - by Zamolxis1 - 10-17-2011, 04:40 PM
RE: Programare - by Altair xD - 10-17-2011, 04:41 PM
RE: Programare - by Zamolxis1 - 10-17-2011, 04:42 PM
RE: Programare - by Szekemri - 10-18-2011, 07:47 PM
RE: Programare - by Zamolxis1 - 10-18-2011, 07:51 PM
RE: Programare - by Altair xD - 10-30-2011, 06:25 PM
RE: Programare - by Szekemri - 10-30-2011, 07:16 PM
RE: Programare - by Szekemri - 10-30-2011, 07:01 PM
RE: Programare - by Altair xD - 10-30-2011, 07:05 PM
RE: Programare - by Altair xD - 10-30-2011, 08:34 PM
RE: Programare - by Hegan - 10-31-2011, 09:00 PM
RE: Programare - by Szekemri - 10-31-2011, 10:54 PM
RE: Programare - by Szekemri - 11-30-2011, 05:42 PM
RE: Programare - by Zamolxis1 - 11-30-2011, 08:41 PM
RE: Programare - by Dastan - 12-05-2011, 10:06 PM
RE: Programare - by g3orge13 - 12-06-2011, 12:21 AM
RE: Programare - by Dastan - 12-06-2011, 04:55 PM
RE: Programare - by Zamolxis1 - 12-06-2011, 05:00 PM
RE: Programare - by Dastan - 12-06-2011, 10:38 PM
RE: Programare - by Zamolxis1 - 12-07-2011, 05:39 PM
RE: Programare - by Dastan - 12-07-2011, 05:55 PM
RE: Programare - by Zamolxis1 - 12-07-2011, 08:38 PM
RE: Programare - by Szekemri - 12-07-2011, 11:27 PM
RE: Programare - by Zamolxis1 - 12-08-2011, 05:05 PM
RE: Programare - by Altair xD - 12-12-2011, 04:47 PM
RE: Programare - by Zamolxis1 - 02-09-2012, 08:15 PM
RE: Programare - by Szekemri - 02-10-2012, 02:38 PM
RE: Programare - by Szekemri - 02-09-2012, 08:21 PM
RE: Programare - by Zamolxis1 - 02-09-2012, 08:24 PM
RE: Programare - by Zamolxis1 - 02-10-2012, 06:57 PM
RE: Programare - by Szekemri - 02-11-2012, 11:39 AM
RE: Programare - by Zamolxis1 - 02-11-2012, 08:21 PM
RE: Programare - by Zamolxis1 - 02-14-2012, 09:11 PM
RE: Programare - by Marius Titulescu - 03-21-2017, 12:05 PM

Forum Jump:


Users browsing this thread: 6 Guest(s)