User
Pass
2FA
 
 

program matrice

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message1140
gigelu

[Mentally Stable]



Status: Offline
(since 27-12-2017 18:00)
Joined: 19 Apr 2010
Posts: 287, Topics: 113
Location: Romania

Reputation: 316.9
Votes: 9

Post Posted: 03-02-2013, 14:49:09 | Translate post to: ... (Click for more languages)

Doresc si eu un program sau sfaturi cam sa-l fac care sa faca asta :
Se citesc 2 nr naturale (n si m)care constituie o matrice cu n linii si m coloane astfel incat fiecare element A(i,j) memoreaza cea mai mica valoare dintre valoare indicilor i si j (1<j<m) si (1<i<n) Se da n=4 si m=5. Daca mi-l puteti face in codeblocks sau in c++ (si il adaptez eu).sau doar sami ziceti in cuvinte ce am de facut.
MUltumesc

0 0
  
Back to top
View user's profile Send private message
Raster

[ACNA]



Status: Offline
(since 02-09-2016 09:51)
Joined: 24 Feb 2011
Posts: 5377, Topics: 210
Location: In my mind palace

Reputation: 765.4
Votes: 81

     
Post Posted: 03-02-2013, 17:11:41 | Translate post to: ... (Click for more languages)

Code:

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

int main()
{
int m,n,i,j,a[10][9];
cout<<"m="; cin>>m;
cout<<"n="; cin>>n;
for (i=0;i<m;i++)
for (j=0;j<n;j++)
{
cout<<"a["<<i+1<<','<<j+1<<"]=";
cin>>a[i][j];
}
for (i=0;i<m;i++)
{
for (j=0;j<n;j++)
cout<<a[i][j]<<' ';
cout<<endl;
}
system("PAUSE");
return 0;
}


LE: A, wait, fail, asta doar iti afiseaza matricea n/m, n-am citit bine.



воронья
0 0
  
Back to top
View user's profile Send private message
mojii

[Mentally Stable]



Status: Offline
(since 13-05-2015 11:58)
Joined: 16 Jan 2011
Posts: 85, Topics: 13
Location: Romania

Reputation: 122.1
Votes: 2

 
Post Posted: 03-04-2013, 14:54:35 | Translate post to: ... (Click for more languages)

Tiam facut eu cv dar nu inteleg care e treaba cu conditia asta asta: (1<j<m) si (1<i<n) . Daca nu e true eu am mmorat in a(i,j) 0.
Code:

#include <iostream>

using namespace std;

int main()
{
   int m = 0,
      i = 0,
      j = 0,
      n = 0,
      a[15][15];

   cout<<"n="; cin>>n;
   cout<<"m="; cin>>m;

   for (i=0;i<n;i++)
      for (j=0;j<m;j++){
         if ((i > j) && (j < m) && (i < n) && (i > 1) && (j >1))
            a[i][j] = j;
         else if ((j > i) && (j < m) && (i < n) && (i > 1) && (j >1))
            a[i][j] = i;
         else a[i][j] = 0;
   }
   for (i=0;i<n;i++){
      for (j=0;j<m;j++)
         cout<<a[i][j]<<' ';
   cout<<endl;
   }
   
   system("PAUSE");
   return 0;
}

0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 03-12-2024, 08:46:36
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x