/*
* the syntax for a function is :
* <return_type> <function_name> ( <parameters> )
*/
void some_funtion( void )
{
// ifstream class is used to "read" from a file
// ofstream on the other hand is used to "write" to a file
ifstream inputFile;
// open the file :
// replace <name_of_file> with the actual name of the file
// you want to read from
inputFile.open( "<name_of_file>.txt" );
// create a variable to hold the "total" sum :
int sum = 0;
// create another variable to hold the temporary value read
int temp;
// read, add it to sum, read again, add to sum, and so on
// until end of file is found
while( inputFile >> temp )
sum += temp; // this is the same as temp = temp + sum
/* Now, a simple test :
* all you need to do is print the value of sum variable,
* i assume you know cout ?
*/
// ...
}