#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[]) {
int suma,n,a[100][100],b[100][100],c[100][100];
srand(time(0));
cout<<"Defina de cuanto es la matriz: ";cin>>n;
cout<<endl;
cout<<"MATRIZ(1)"<<"\n";
for(int x=0; x<n;x++){
cout<<"[ ";
for(int y=0; y<n; y++){
a[x][y]=rand()%(60-30+1)+30;
b[x][y]=rand()%(9-1+1)+1;
cout<<" "<<a[x][y];
}
cout<<" ]"<<endl;
}
cout<<"MATRIZ(2)"<<"\n" ;
for(int x=0; x<n;x++){
cout<<"[";
for(int y=0; y<n; y++){
cout<<" "<<b[x][y];
}
cout<<" ]"<<endl;
}
cout<<"MATRIZ(3)"<<"\n";
suma=0;
for(int x=0; x<n;x++){
cout<<"[";
for(int y=0; y<n; y++){
c[x][y]=a[x][y]*b[x][y];
suma=a[x][y]+b[x][y];
if( (x>0 && x<n-1 && y>0 && y<n-1))
{
cout<<" "<<suma;
}
else
{
cout<<" "<<c[x][y];
}
}
cout<<" ]"<<endl;
}
return 0;
}
Access hereTo be able to comment
TheWhiteCode.com is not the creator or owner of the images shown on this page. Sources: (11)
- /static/assets/img/avatars/av_sofiamarkovic.jpg
- /static/assets/img/posts/vier-stunden-uebungsblatt-zwei-davon-schicht-die-rechnung-die-niemand-aufstellt/2.jpg
- /static/assets/img/posts/bitcoin-bei-52-000-mein-bot-die-zahlen-und-das-geruecht-das-mich-fast-gerettet-haette/2.jpg
- /static/assets/img/posts/bitcoin-bei-52-000-mein-bot-die-zahlen-und-das-geruecht-das-mich-fast-gerettet-haette/1.jpg
- /static/assets/img/posts/das-modell-war-zu-94-prozent-sicher-bei-einem-datensatz-den-es-schon-kannte/2.jpg
- /static/assets/img/posts/vier-stunden-uebungsblatt-zwei-davon-schicht-die-rechnung-die-niemand-aufstellt/1.jpg
- /static/assets/img/posts/das-modell-war-zu-94-prozent-sicher-bei-einem-datensatz-den-es-schon-kannte/1.jpg
- /static/assets/img/posts/sechs-klassen-fuer-eine-aufgabe-wie-solid-ein-gruppenprojekt-zerlegt/1.jpg
- /static/assets/img/posts/speicher-ist-endlich-ich-auch-ein-c-programm-das-mir-das-wochenende-erklaert-hat/1.jpg
- /static/assets/img/posts/speicher-ist-endlich-ich-auch-ein-c-programm-das-mir-das-wochenende-erklaert-hat/2.jpg
- /static/assets/img/posts/sechs-klassen-fuer-eine-aufgabe-wie-solid-ein-gruppenprojekt-zerlegt/2.jpg
Comments (0)