Cpsc 440 Problem Set 1 Question 4

Cpsc 440 Problem Set 1 Question 4 - hw1p4.c#include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
hw1p4.c 2/13/2008 # include < math . h > # include < stdio . h > # include < stdlib . h > # define ERROR_MARGIN 1e-6 float evaluate_y ( float t ) ; float evaluate_yprime ( float t ) ; float next_newton ( float t_0 ) ; float evaluate_x ( float t ) ; int main ( int argc , char * argv [] ) { // Extract the command-line arguments if ( argc ! = 2 ) { printf ( "\nERROR: %s expects 2 arguments, given %i\n" , argv [ 0 ] , argc ) ; return ( 1 ) ; } char * output_file_name = argv [ 1 ] ; // Open the output file printf ( "\nAttempting to open file %s for writing. ..\n" , output_file_name ) ; FILE * out ; out = fopen ( output_file_name , "w" ) ; if ( out = = NULL ) { printf ( "Failed to open file: %s for writing.\n" , output_file_name ) ; fclose ( out ) ; return ( 2 ) ; } printf ( "Successfully opened file: %s for writing.\n" , output_file_name ) ; fprintf ( out , "Successfully opened file: %s for writing.\n" , output_file_name ) ; // We know that the equations of motion represent a projectile, // so
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/19/2008 for the course CPSC 440 taught by Professor Vladimirrokhlin during the Spring '08 term at Yale.

Page1 / 3

Cpsc 440 Problem Set 1 Question 4 - hw1p4.c#include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online