All pastes #459868 Raw Edit

Untitled

public text v1 · immutable
#459868 ·published 2007-04-26 18:58 UTC
rendered paste body
#include <stdio.h>
  #include <string.h>

  #define atomic_number 2
  #define size 15
  #define chem_symbol 2
  #define class 25

  typedef struct
{
      char type[class];
      char symbol[chem_symbol];
      char name[size];
      int atomic;
      int shell[7];
      double weight;
}
      element_t;

   int main (void)
{
  element_t chem;


     printf("Element name: \n");
     gets(chem.name);
     printf("%s",chem.name);

  printf("Enter Chemical Symbol:  \n");
  scanf("%s",&chem.symbol);
  
  printf("Enter class:  \n");
  scanf("%s",&chem.type);

  printf("Enter Atomic Number:  \n");
  scanf("%d",&chem.atomic);
   
  printf("Enter atomic weight: \n");
  scanf("%lf",&chem.weight);

  printf("Enter the number of electrons:  \n");
  scanf("%d",&chem.shell[7]);

 printf("You entered: ");
 puts(chem.symbol);
 puts(chem.name);
  return 0;

}