Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programare
#61
ok...mersi oricum, ca ma doare capu deja la cat m-am ganditHaha.
"Errare humanum est sed perseverare diabolicum."
"Gutta cavat lapidem non vi, sed saepe cadendo."
"Inter arma silent leges."

replyReply
#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
#63
Vectorii sunt mai usori dar matricele mai utile. Baga mare!
replyReply


Forum Jump:


Users browsing this thread: 1 Guest(s)