Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <cstdlib>
- using namespace std;
- struct Complex{
- int real;
- double imaginar;
- }x;
- void citire(struct Complex **x, int n, int m)
- {
- int i=0, j=0;
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- cout << "Elementul [" << i+1 << "][" << j+1 << "]: " << endl;
- cin >> x[i][j].real;
- cin >> x[i][j].imaginar;
- }
- }
- }
- void afisare(struct Complex **x, int n, int m)
- {
- int i=0, j=0;
- for(i=0;i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- cout << x[i][j].real << ' ' << x[i][j].imaginar << ' ' << endl;
- }
- }
- }
- int main()
- {
- struct Complex **x;
- int n=0,m=0;
- cout << "Cate linii ? "; cin >> n;
- cout << "Cate coloane ? "; cin >> m;
- x = (Complex**) malloc (n*m * sizeof (Complex));
- for (int i = 0; i < n; i++)
- {
- x[i] = (Complex*) malloc (n * sizeof (Complex));
- }
- citire(x,n,m);
- afisare(x,n,m);
- return 0;
- }
- ///1.main -> matrice tip complex din u x u struct parte reala, imaginara (double)
- ///citeste matricea
- ///f. cautare un element comlex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement