All pastes #258736 Raw Edit

Unnamed

public c v1 · immutable
#258736 ·published 2006-11-26 20:26 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>struct vector3d {   float x;   float y;   float z;};int main(){   FILE *fp;   struct vector3d myvectors[2];   fp = fopen("dianismata.txt", "r");   if (!fp) {      fprintf(stderr, "Error opening file\n");      exit(EXIT_FAILURE);   }   /* Read vectors' coordinates */   fscanf(fp, "%f%f%f", 	  &myvectors[0].x,	  &myvectors[0].y,	  &myvectors[0].z);   fscanf(fp, "%f%f%f",	  &myvectors[1].x,	  &myvectors[1].y,	  &myvectors[1].z);   /* Print vectors' coordinates */   printf("v1(x, y, z) = (%f, %f, %f)\n", 	  myvectors[0].x, 	  myvectors[0].y, 	  myvectors[0].z);   printf("v2(x, y, z) = (%f, %f, %f)\n",          myvectors[1].x,          myvectors[1].y,          myvectors[1].z);   return EXIT_SUCCESS;}