Home Forums C Programming Please help me Re: Re: Please help me

#3479
GWILouisaxwzkla
Participant

4.


/****************************************************************
* File Name : c:programshelptempCG.cpp
* Date : November,17,2008
* Comments : new project
* Compiler/Assembler :
*
*
*
*
*
* Program Shell Generated At: 7:02:58 p.m.
=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


#include < stdio.h >
//#include < string.h >
//#include < conio.h >
//#include < math.h >
//#include < iomanip >
//#include < ctype.h >
#define MAX_LENGTH 50



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@



//##################################################################################


//main function ******************************

int main ( )
{

FILE * file1 = fopen ( "c:\programs\data.txt", "r+" );
FILE * file2 = fopen ( "c:\programs\data2.txt", "w+" );
char word [ MAX_LENGTH ];

if( file1 == 0 || file2 == 0 )
{
printf( "A file did not open n" );
return 1;
}

fscanf ( file1 , "%s", & word );
while ( ! feof ( file1 ) )
{

fprintf( file2 , word );
fprintf( file2 , "n" );
fscanf ( file1 , "%s", & word );
}
fclose ( file1 );
fclose ( file2 );
return 0;

}

5.


/****************************************************************
* File Name : c:programshelptempCG.cpp
* Date : November,17,2008
* Comments : new project
* Compiler/Assembler :
*
*
*
*
*
* Program Shell Generated At: 7:02:58 p.m.
=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


#include < stdio.h >
//#include < string.h >
//#include < conio.h >
//#include < math.h >
//#include < iomanip >
//#include < ctype.h >
#define MAX_LENGTH 50



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@



//##################################################################################


//main function ******************************

int main ( )
{

int one , two , three , smallest;

printf ( "enter an integer: " );
scanf ( "%i" , & one );
printf ( "enter an integer: " );
scanf ( "%i" , & two );
printf ( "enter an integer: " );
scanf ( "%i" , & three );

if ( one < two )
smallest = one;
else
smallest = two;
if ( three < smallest )
smallest = three;

printf ( "the smallest is %i n" , smallest );


}