a IX-a A27 lecții INFORMATICĂ | 34 lecții T.I.C.
Informatică
Lectia 00001   |   Lectia 00   |   Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04   |   Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08   |   Lectia 09   |   Lectia 10   |   Lectia 101   |   Lectia 102   |   Lectia 103   |   Lectia 11   |   Lectia 11_2   |   Lectia 12   |   Lectia 12_2   |   Lectia 12_3   |   Lectia 12_4   |   Lectia 12_5   |   Lectia 13   |   Lectia 14   |   Lectia 17
Lectia 18   |   Lectia 19
T.I.C.

Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04
Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08   |   Lectia 09
Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14   |   Lectia 15   |   Lectia 16   |   Lectia 17   |   Lectia 18   |   Lectia 19   |   Lectia 19   |   Lectia 20   |   Lectia 23   |   Lectia 24   |   Lectia 26   |   Lectia 27   |   Lectia 28   |   Lectia 29   |   Lectia 30_2   |   Lectia 31   |   Lectia 32   |   Lectia 33   |   Lectia 34   |   Lectia 35   |   Lectia 36
a IX-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a IX-a C0 lecții INFORMATICĂ | 29 lecții T.I.C.
T.I.C.
Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04
Lectia 05   |   Lectia 06   |   Lectia 07   |   Lectia 08
Lectia 10   |   Lectia 12   |   Lectia 13   |   Lectia 14   |   Lectia 15   |   Lectia 16   |   Lectia 17   |   Lecția 18   |   Lectia 19   |   Lectia 20   |   Lectia 21   |   Lectia 22   |   Lectia 23   |   Lectia 24   |   Lectia 25   |   Lectia 26   |   Lectia 27   |   Lectia 28   |   Lectia 29   |   Lectia 30   |   Lectia 31
a IX-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a IX-a E0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a A6 lecții INFORMATICĂ | 29 lecții T.I.C.
Opțional
Fișa 01   |   Fișa 02   |   Fișa 03   |   Fișa 04   |   Fișa 05   |   Lectia 20
T.I.C.

Lectia 07   |   Lectia 08   |   Lectia 09   |   Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14
Lecția 14_1
Lectia 15
Lectia 16   |   Lectia 17   |   Lectia 19   |   Lectia 20
Lectia 21   |   Lecția 22   |   Lectia 23   |   Lectia 24   |   Lectia 25   |   Lectia 26   |   Lectia 27   |   Lectia 28
Lectia 29   |   Lectia 30   |   Lectia 31   |   Lectia 32   |   Lectia 33   |   Lectia 34   |   Lectia 35
a X-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a X-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a A30 lecții INFORMATICĂ | 0 lecții T.I.C.
Informatică
Lectia 07   |   Lectia 08   |   Lectia 09
Lectia 09 --- [ 2 Probleme rezolvate ]
1. Sa se scrie un program C++ care citeste o matrice si interschimba intre ele doua linii din matrice.
Propune o soluție

S
o
l
u
ț
i
a:
Introdu următorul text: 481530030
#include <iostream>
using namespace std;
void citireMatrice(int a[20][20], int m, int n)
{
     int i,j;
     for(i=0;i<m;i++)
        for(j=0;j<n;j++)
           {
              cout<<"a["<<i<<"]["<<j<<"]= ";
              cin>>a[i][j];
           }
}
void afisareMatrice(int a[20][20], int m, int n)
{
     int i,j;
     for(i=0;i<m;i++)
     {
        for(j=0;j<n;j++)
           cout<<a[i][j]<<" ";
        cout<<endl;
     }
}
void interschimbaLinii(int a[20][20], int m, int n)
{
     int i,j,k,l,aux;
     cout<<"Introduceti numarul liniilor care vor fi interschimbate;";
     cout<<"Linia k= ";cin>>k;
     cout<<"Linial= ";cin>>l;
     for(j=0;j<n;j++)
     {
        aux=a[k][j];
        a[k][j]=a[l][j];
        a[l][j]=aux;
     }
     cout<<"Matricea cu liniile "<<k<<" si "<<l<<" interschimbate este:"<<endl;
     afisareMatrice(a,m,n);
}

int main()
{
      int a[20][20],m,n;
      cout<<"m= ";cin>>m;
      cout<<"n= ";cin>>n;
      cout<<"Introduceti elementele matricii
";
      citireMatrice(a,m,n);
      cout<<"Matricea citita este:"<<endl;
      afisareMatrice(a,m,n);
      interschimbaLinii(a,m,n);
return 0;
}
2. Sa se scrie un program C++ care citeste o matrice si interschimba intre ele doua coloane din matrice.
Propune o soluție

S
o
l
u
ț
i
a:
Introdu următorul text: 95566811
//Sa se scrie un program care interschimba intr-o matrice doua linii date

#include <iostream>
using namespace std;
void citireMatrice(int a[20][20], int m, int n)
{
     int i,j;
     for(i=0;i<m;i++)
        for(j=0;j<n;j++)
           {
              cout<<"a["<<i<<"]["<<j<<"]= ";
              cin>>a[i][j];
           }
}
void afisareMatrice(int a[20][20], int m, int n)
{
     int i,j;
     for(i=0;i<m;i++)
     {
        for(j=0;j<n;j++)
           cout<<a[i][j]<<" ";
        cout<<endl;
     }
}
void interschimbaColoane(int a[20][20], int m, int n)
{
     int i,j,k,l,aux;
     cout<<"Introduceti numarul coloanelor care vor fi interschimbate;";
     cout<<"Coloana k= ";cin>>k;
     cout<<"coloana l= ";cin>>l;
     for(j=0;j<n;j++)
     {
        aux=a[j][k];
        a[j][k]=a[j][l];
        a[j][l]=aux;
     }
     cout<<"Matricea cu coloanele "<<k<<" si "<<l<<" interschimbate este:"<<endl;
     afisareMatrice(a,m,n);
}

int main()
{
      int a[20][20],m,n;
      cout<<"m= ";cin>>m;
      cout<<"n= ";cin>>n;
      cout<<"Introduceti elementele matricii
";
      citireMatrice(a,m,n);
      cout<<"Matricea citita este:"<<endl;
      afisareMatrice(a,m,n);
      interschimbaColoane(a,m,n);
return 0;
}

Fii primul care comentează lecţia
     Submit
  |   Lectia 10   |   Lectia 11   |   Lectia 12   |   Lectia 13   |   Lectia 14
Lectia 16   |   Lectia 18   |   Lectia 19   |   Lectia 20   |   Lectia 21
Lectia 23   |   Lectia 24
Lectia 36
Lectia 40   |   Lectia 41   |   Lectia 42   |   Lectia 43   |   Lectia 44   |   Lectia 45   |   Lectia 46   |   Lectia 46_1
Lectia 47   |   Lectia 48   |   Lectia 49   |   Lectia 50   |   Lectia 50_1
Lectia 50_2
a XI-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XI-a D0 lecții INFORMATICĂ | 15 lecții T.I.C.
T.I.C.
Fişa 01   |   Fişa 02   |   Fişa 03   |   Fişa 04   |   Fişa 05   |   Fişa 06   |   Fişa 07
Fisa C08_2022_1
Lectia 01   |   Lectia 02   |   Lectia 03   |   Lectia 04   |   Lectia 05   |   Lectia 06   |   Lectia 07
a XI-a E0 lecții INFORMATICĂ | 1 lecții T.I.C.
T.I.C.
Fişa 01
a XII-a A2 lecții INFORMATICĂ | 6 lecții T.I.C.
Informatică
Lectia 01   |   Lectia 02
T.I.C.

Fişa 01   |   Fişa 02   |   Fişa 03   |   Fişa 04   |   Fişa 05   |   Fişa 06
a XII-a B0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a C0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a D0 lecții INFORMATICĂ | 0 lecții T.I.C.
a XII-a E0 lecții INFORMATICĂ | 0 lecții T.I.C.
Excelenta A0 lecții INFORMATICĂ | 0 lecții T.I.C.