Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct TipoPonto {
  5.    float x, y;
  6.    }dot;
  7.  
  8. void trocaCoordenadas(struct TipoPonto *ponto);
  9.  
  10. int main() {
  11.    
  12.     printf("digite a coordenada x: ");
  13.     scanf("%f", &dot.x);
  14.     printf("digite a coordenada y: ");
  15.     scanf("%f", &dot.y);
  16.    
  17.     trocaCoordenadas(&dot);
  18.    
  19.     printf("x = %.2f , y = %.2f", dot.x, dot.y);
  20.    
  21.     printf("\n\n");
  22.     system("pause");
  23. }
  24.  
  25. void trocaCoordenadas(struct TipoPonto *ponto){
  26.      float aux;
  27.    
  28.      aux = (*ponto).x;
  29.      (*ponto).x = (*ponto).y;
  30.      (*ponto).y = aux;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement