Advertisement
Lagx

clase 12/09/17

Sep 12th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. //DECLARACION DE UN NUEVO TIPO DE DATO
  4. typedef struct punto
  5. {
  6.     int x,y;
  7.    
  8. } puntito;
  9.  
  10. typedef struct circunferencia
  11. {
  12.     puntito centro;
  13.     float radio;
  14.    
  15. } circunferencia;
  16.  
  17. int main()
  18. {
  19.     circunferencia c1,*c2;
  20.    
  21.     c1.centro.x=1;
  22.     c1.centro.y=1;
  23.     c1.radio=5;
  24.    
  25.     c2 = &c1;
  26.    
  27.     //leer el centro de la circunferencia
  28.     scanf("%d%d", &c1.centro.x,&c1.centro.y);
  29.     scanf("%f", &c1.radio);
  30.    
  31.     printf("centro = (%d,%d) y radio = %f\n",c2->centro.x,c2->centro.y,c2->radio);
  32.    
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement