Lab2A - cpres=cpres 1 if(time>2.5 || time<2...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 # include <stdio.h> # include <stdlib.h> # include <math.h> # define filename "suture.txt" int main() { /* Define and Initialize Variables */ int batchnumber float temp, pres, time, ptemp, ppres, ptime int ctemp=0, cpres=0, ctime=0 int line=1 i FILE *suture F /*open file*/ suture = fopen(filename, "r") s printf("These are the batchnumbers, along with the temperature, pressure " "and time reading of sutures that failed quaility control.\n\n\n") " /*do-while loop*/ do { f if (temp>170 || temp<150) { printf("Batchnumber %i failed with temperature %f degrees Celsius.\n\n", batchnumber, temp) ctemp=ctemp+1 } if (pres>70 || pres<60) { printf("Batchnumber %i failed with pressure %f psi.\n\n", batchnumber, pres)
Background image of page 1

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

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

Unformatted text preview: cpres=cpres+1 } if (time>2.5 || time<2) { printf("Batchnumber %i failed with dwell time %f seconds.\n\n", batchnumber, time) ctime=ctime+1 } line=line+1 l }while(line<=11) } /*calculate percentages*/ ptemp = ctemp*9.0909 ppres = cpres*9.0909 ptime = ctime*9.0909 Sheet1 Page 2 printf("\n\n\n") p /*print data and percentages*/ printf("%i have failed by temperature (%f percent).\n\n", ctemp, ptemp) p printf("%i have failed by pressure (%f percent).\n\n", cpres, ppres) p printf("%i have failed by dwell time (%f percent).\n\n", ctime, ptime) p /*close file*/ fclose(suture) f /*exit program*/ return EXIT_SUCCESS }...
View Full Document

This note was uploaded on 04/17/2008 for the course CS 1023 taught by Professor Kerstetter during the Spring '08 term at Western Michigan.

Page1 / 2

Lab2A - cpres=cpres 1 if(time>2.5 || time<2...

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