lab12 - while (fscanf(input,...

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

View Full Document Right Arrow Icon
#include <stdio.h> #include <string.h> int main( void ) { FILE *docu; int i,length; char stry[101],locat[101]; printf( "Enter the file name: " ); gets(locat); docu=fopen(locat, "w" ); for (i=0;i<5;i++) { printf( "Enter string: " ); gets(stry); length=strlen(stry); fprintf(docu, "%s\t%d\n" ,stry,length); } fclose(docu); return 0; }
Background image of page 1

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

View Full DocumentRight Arrow Icon
#include <stdio.h> #include <math.h> int main( void ) { FILE *input,*output; double num,result; input=fopen( "C:\\input.txt" , "r" ); output=fopen( "C:\\output.txt" , "w" );
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while (fscanf(input, &quot;%lf&quot; ,&amp;num)!=EOF) { result=sqrt(num); fprintf(output, &quot;%-3.3g\t%3.3g\n&quot; ,num,result); } fclose(input); fclose(output); return 0; } #include &lt;stdio.h&gt; #include &lt;math.h&gt; int main( void ) { FILE *input; int student[5][6],i,j; input=fopen( &quot;C:\\input.txt&quot; , &quot;r&quot; ); for (i=0;i&lt;5;i++) { for (j=0;j&lt;6;j++) fscanf(input, &quot;%d&quot; ,&amp;student[i][j]); } fclose(input); return 0; }...
View Full Document

This note was uploaded on 09/04/2011 for the course EE 140 taught by Professor Lanxiang during the Spring '11 term at Montgomery College.

Page1 / 3

lab12 - while (fscanf(input,...

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

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