home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / tcpp / examples / intro30.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-10  |  539 b   |  30 lines

  1. /* INTRO30.C - Beispiel aus Kapitel 4 der
  2.    Einführung */
  3.  
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. typedef struct {
  8.    char name[10];
  9.    float abstand;
  10.    float radius;
  11. } planet;
  12.  
  13. planet mars;
  14.  
  15. int main()
  16. {
  17.    strcpy(mars.name,"Mars");
  18.    mars.abstand = 1.5;
  19.    mars.radius = 0.4;
  20.  
  21.    printf("Planetenstatistik:\n");
  22.    printf("Name: %s\n", mars.name);
  23.    printf("Entfernung von der Sonne: %4.2f\n",
  24.           mars.abstand);
  25.    printf("Radius (in Erdradien): %4.2f\n",
  26.           mars.radius);
  27.  
  28.    return 0;
  29. }
  30.