Programa Io3

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#include<stdio.

h>
#include<conio.h>
#include<stdlib.h>
#include<iostream.h>
void main(){
float mat[30][30],resta;
int fil,col,F,C,vec;
char eleccion;
float max[60], min[60],maxmax=0,minmax=10000;
cout<<"INGRESE LA FILA:
";
cin>>F;
cout<<"INGRESE LA COLUMNA: ";
cin>>C;
cout<<"BENEFICIO 'b' O COSTO 'c': ";
cin>>eleccion;
if(eleccion=='c')
{
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
cout<<"ingrese un numero
: ";
cin>>mat[fil][col];
}
}
/////////mostrar
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
cout<<mat[fil][col]<<" ";
}
cout<<"\n";
}
///////menor de columnas
for(col=1;col<=C;col++)
{ min[col]=1222;
for(fil=1;fil<=F;fil++)
{
if(mat[fil][col]<=min[col])
{
min[col]=mat[fil][col];
}
}
cout<<"el menor es :
"<<min[col];
cout<<"\n";
}
//////restar
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
resta=mat[fil][col]-min[col];
mat[fil][col]=resta;
cout<< resta<<" ";
}
cout<<"\n";
}
////busca el maximo de las filas

for(fil=1;fil<=F;fil++)
{
max[fil]=0;
for(col=1;col<=C;col++)
{
if(mat[fil][col]>=max[fil])
{
max[fil]=mat[fil][col];
}
}
cout<<"los maximos de cada fila es :
"<<max[fil];
cout<<"\n";
}
//////selecciona el max de los maximos
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
if(max[fil]<=minmax)
{
minmax=max[fil];
}
}
cout<<"\n";
}
cout<<"el min de los maximos es :
"<<minmax;
}
else
{
//////////////////beneficio
if(eleccion=='b')
{
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
cout<<"ingrese un numero
: ";
cin>>mat[fil][col];
}
}
/////////mostrar
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
cout<<mat[fil][col]<<" ";
}
cout<<"\n";
}
///////mayor de columnas
for(col=1;col<=C;col++)
{ max[col]=0;
for(fil=1;fil<=F;fil++)
{
if(mat[fil][col]>=max[col])
{
max[col]=mat[fil][col];
}
}

cout<<"el mayor es :
cout<<"\n";
}

"<<max[col];

//////restar
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
resta=max[col]-mat[fil][col];
mat[fil][col]=resta;
cout<< resta<<" ";
}
cout<<"\n";
}
////busca el maximo de las filas
for(fil=1;fil<=F;fil++)
{
max[fil]=0;
for(col=1;col<=C;col++)
{
if(mat[fil][col]>=max[fil])
{
max[fil]=mat[fil][col];
}
}
cout<<"los maximos de cada fila es :
"<<max[fil];
cout<<"\n";
}
//////selecciona el min de los maximos
for(fil=1;fil<=F;fil++)
{
for(col=1;col<=C;col++)
{
if(max[fil]>=maxmax)
{
maxmax=max[fil];
}
}
cout<<"\n";
}
cout<<"los maximos de los maximos es :
"<<maxmax;
}
}
getch();
}

You might also like