Home › Forums › C Programming › Please help me › Re: Re: Please help me
November 18, 2008 at 11:39 pm
#3479
GWILouisaxwzkla
Participant
4.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | <br /> /****************************************************************<br /> * File Name : c:programshelptempCG.cpp<br /> * Date : November,17,2008<br /> * Comments : new project<br /> * Compiler/Assembler :<br /> *<br /> *<br /> *<br /> *<br /> *<br /> * Program Shell Generated At: 7:02:58 p.m.<br /> =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /> <br /> <br /> #include < stdio.h ><br /> //#include < string.h ><br /> //#include < conio.h ><br /> //#include < math.h ><br /> //#include < iomanip ><br /> //#include < ctype.h ><br /> #define MAX_LENGTH 50<br /> <br /> <br /> <br /> //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /> <br /> <br /> <br /> //##################################################################################<br /> <br /> <br /> //main function ******************************<br /> <br /> int main ( )<br /> {<br /> <br /> FILE * file1 = fopen ( "c:\programs\data.txt", "r+" );<br /> FILE * file2 = fopen ( "c:\programs\data2.txt", "w+" );<br /> char word [ MAX_LENGTH ];<br /> <br /> if( file1 == 0 || file2 == 0 )<br /> {<br /> printf( "A file did not open n" );<br /> return 1;<br /> }<br /> <br /> fscanf ( file1 , "%s", & word );<br /> while ( ! feof ( file1 ) )<br /> {<br /> <br /> fprintf( file2 , word );<br /> fprintf( file2 , "n" );<br /> fscanf ( file1 , "%s", & word );<br /> }<br /> fclose ( file1 );<br /> fclose ( file2 );<br /> return 0;<br /> <br /> }<br /> |
5.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <br /> /****************************************************************<br /> * File Name : c:programshelptempCG.cpp<br /> * Date : November,17,2008<br /> * Comments : new project<br /> * Compiler/Assembler :<br /> *<br /> *<br /> *<br /> *<br /> *<br /> * Program Shell Generated At: 7:02:58 p.m.<br /> =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/<br /> <br /> <br /> #include < stdio.h ><br /> //#include < string.h ><br /> //#include < conio.h ><br /> //#include < math.h ><br /> //#include < iomanip ><br /> //#include < ctype.h ><br /> #define MAX_LENGTH 50<br /> <br /> <br /> <br /> //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@<br /> <br /> <br /> <br /> //##################################################################################<br /> <br /> <br /> //main function ******************************<br /> <br /> int main ( )<br /> {<br /> <br /> int one , two , three , smallest;<br /> <br /> printf ( "enter an integer: " );<br /> scanf ( "%i" , & one );<br /> printf ( "enter an integer: " );<br /> scanf ( "%i" , & two );<br /> printf ( "enter an integer: " );<br /> scanf ( "%i" , & three );<br /> <br /> if ( one < two )<br /> smallest = one;<br /> else<br /> smallest = two;<br /> if ( three < smallest )<br /> smallest = three;<br /> <br /> printf ( "the smallest is %i n" , smallest );<br /> <br /> <br /> }<br /> <br /> <br /> <br /> <br /> <br /> |