Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- typedef struct
- {
- float Re, Im;
- }Complex;
- int CitajNiz(char name[], Complex niz[])
- {
- int n=0;
- FILE *in;
- Complex k;
- in=fopen(name, "r");
- if(in==NULL)
- return 0;
- while(1)
- {
- fscanf(in,"%f%f", &k.Re, &k.Im);
- if(feof(in)) break;
- niz[n]=k;
- n++;
- }
- fclose(in);
- return n;
- }
- float Moduo(Complex k)
- {
- return sqrt(pow(k.Re,2)+pow(k.Im,2));
- }
- main()
- {
- Complex niz1[100], niz2[100];
- int n1, n2;
- n1=CitajNiz("ulaz1.txt", niz1);
- n2=CitajNiz("ulaz2.txt", niz2);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement