Untitled


SUBMITTED BY: itsDaveLad

DATE: March 9, 2016, 5:17 p.m.

FORMAT: Text only

SIZE: 681 Bytes

HITS: 700

  1. #include "source.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. struct vessel create_vessel(const char *p_name, double p_length, double p_depth, struct cargo p_crg)
  6. {
  7. struct vessel vene;
  8. strncpy(vene.name, p_name, 30);
  9. vene.name[30] = '\0';
  10. vene.length = p_length;
  11. vene.depth = p_depth;
  12. vene.crg = p_crg;
  13. return vene;
  14. }
  15. void print_vessel(const struct vessel *ship)
  16. {
  17. printf("%s\n", ship->name);
  18. printf("%.1f\n", ship->length);
  19. printf("%.1f\n", ship->depth);
  20. printf("%s\n", ship->crg.title);
  21. printf("%.1d\n", ship->crg.quantity);
  22. printf("%.1f\n", ship->crg.weight);
  23. }

comments powered by Disqus