I need some help with an assignment, it is supposed to have 9 functions, one being main, and the other 8 void. The ONLY global variables that are allowed is the istream and ofstream. All programs in main are to execute in the order listed. I compile the program it is successful, it even runs, but there is nothing in the output file nor when I try it as couts instead of FileOut, I get nothing, not even the first one function. Please help and see if I am missing something obvious.

//C Language
//Chapter 8 Assignment8_1.cpp
//This program is a rewrite for Chapter 6 program 1 with separate functions.

#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>

using namespace std;


ifstream FileIn;
ofstream FileOut;

	
void PartA();
void PartB();
void PartC();
void PartD();
void PartE();
void PartF();
void PartG();
void PartH();


int main()
{

FileOut.open ("o:\\Answers2.txt");
	

void PartA();
void PartB();
void PartC();
void PartD();
void PartE();
void PartF();
void PartG();
void PartH();      
                                                                                                          
return 0;

}
	
void PartA()
{
	    //Part A
		FileIn.open ("O:\\DataFile2.txt");
		int NUM;

      	while (FileIn >> NUM)
			{		
			FileOut << NUM << " " ;
			}	

				{
				FileIn.close();
				FileIn.clear();
				}
	    
}

void PartB()
{
		//Part B
		FileIn.open ("o:\\DataFile2.txt");
		int NUM;
		float sum = 0;
		float count = 0;
		float avg;

		while (FileIn >>NUM)
		{
		sum = sum + NUM;
		count++;
		}

			{
			avg = sum / count;
			FileOut << fixed << setprecision(3)  << avg << " ";
			}
					{
					FileIn.close();
					FileIn.clear();
					}
}	


void PartC()
{
		//Part C
		FileIn.open ("o:\\DataFile2.txt");

	   
	   int count = 0;
	   int NUM;
	   float avg;
	   float sum = 0;

		while (count != 12)
		{
		FileIn >>NUM;
		sum = sum + NUM;
		count++;
		}
		
			{
			avg = sum / count;
			FileOut << fixed << setprecision(3)  << avg << " ";
			}
					{
					FileIn.close();
					FileIn.clear();
					}
					
}

void PartD()
{
		//Part D
		FileIn.open ("o:\\DataFile2.txt");

		int count = 0;
		int sum = 0;
		int NUM;


		while (FileIn >> NUM)
		{
		count++;
			if(count % 3 == 0)
			{
			sum = sum + NUM;
			}
		}

				{
				FileOut << fixed << setprecision(3) << sum <<" ";
				}
							{
							FileIn.close();
							FileIn.clear();
							}

	

}

void PartE()
{
		//Part E
		FileIn.open ("o:\\DataFile2.txt");
		int low = 0;
		int high = 0;
		int NUM;
		
		FileIn >> NUM;
		low = NUM;
		high = NUM;
		
		while (FileIn >> NUM)
		{

		if (low > NUM)
			low = NUM;
		if (high < NUM)
			high = NUM;
		

		}
			{
			FileOut << low << " " << high << " ";
			}
					{
					FileIn.close();
					FileIn.clear();
					}
}


void PartF()
{

	//Part F
	FileIn.open ("o:\\DataFile2.txt");
	int NUM;
	int diff1 = 0;
	int diff2 = 0;
	int NewLow = 0;

	FileIn >> NewLow;

	while (FileIn >> NUM)
	{
	diff1 = abs (200 - NewLow);
	diff2 = abs (200 - NUM);


		if (diff1 > diff2)
		NewLow = NUM;

	}
			{
			FileOut << NewLow <<" ";
			}
					{
					FileIn.close();
					FileIn.clear();
					}
}

void PartG()
{
		//Part G
		FileIn.open ("o:\\DataFile2.txt");

	   char charin = ' ';
	   int count2 = 0;
	   int NUM2;
	   float sum2 = 0;
	   float avg4 = 0;

		while (charin != '\n')
		{
		FileIn >>NUM2;
		FileIn.get (charin);
		sum2 = sum2 + NUM2;
		count2++;
		}
		
	   char charin2 = ' ';
	   int count3 = 0;
	   int NUM3;
	   float sum3 = 0;

		while (charin2 != '\n')
		{
		FileIn >>NUM3;
		FileIn.get (charin2);
		sum3 = sum3 + NUM3;
		count3++;
		}

					{
					avg4 = (sum2 + sum3 ) / (count2 + count3);
					FileOut << fixed << setprecision(3)  << avg4 << " ";
					}
								{
								FileIn.close();
								FileIn.clear();

								}
}



void PartH()
{
	//Part H
	FileIn.open ("o:\\DataFile2.txt");
	int sum = 0;
	int NUM;
	
	   
	bool done = true;

	while (done)
	{
	FileIn >> NUM;
		if ( sum + NUM > 1000 )
			done = false;
		else if ( sum + NUM < 1000 )
			sum = sum + NUM;
	}
				{
				FileOut << sum << " ";
				}
							{
							FileIn.close();
							FileIn.clear();
							}

}
void PartA();   // These are function prototypes,
void PartB();   // which is good and proper.
void PartC();
void PartD();
void PartE();
void PartF();
void PartG();
void PartH();


int main()
{

FileOut.open ("o:\\Answers2.txt");
	

void PartA();   // These also are function prototypes,
void PartB();   // not function calls
void PartC();   // Remove the void
void PartD();
void PartE();
void PartF();
void PartG();
void PartH();      
                                                                                                          
return 0;

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.