Hello

I am working on a program where I have to input numbers(as many as I want) and then I want to get the Average and the Standard Deviation from those numbers. I could do this easily if I didn't have to use file i/o. I don't understand how to read the numbers one I have written them to a text file. another thing is that when the program goes to calculate the total it dont do it right. im not sure whats up. if someone could please help me or give me some pointers..
Code:
#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;

void asknumbers(ofstream& myfile,int& howmanynumbers,double& numbers);
void readnumbers(ifstream& outfile, double numbers, double& total);


int main()
{
	ofstream myfile;
	ifstream outfile;
	int howmanynumbers;
	double numbers,total;
	char repeat;

	do
	{
		

		myfile.open("numbers_file.txt",ios::trunc);			//opens and deletes everything from before
		myfile.close();										//closes file

		asknumbers(myfile,howmanynumbers,numbers);			//function for asking numbers
		readnumbers(outfile,numbers,total);
		
	

		cout<<"Do you want to repeat: ";
		cin>>repeat;
		

		system("cls");
	}while(repeat=='y'||repeat=='Y');						//end first do loop

	system("pause");
	return 0;
}



void asknumbers(ofstream& myfile,int& howmanynumbers,double& numbers)
{

	cout<<"how many numbers do you want to input:";			//asks how many number i want to put in
	cin>>howmanynumbers;

	int numbercounter;
	numbercounter=howmanynumbers;

		do													//asks for the numbers
		{

			cout<<"enter the numbers:";
			cin>>numbers;

			myfile.open ("numbers_file.txt",ios::app);		//writes to file called numbers_file.txt
			myfile<<numbers<<endl;							//writes numbers to the file
			myfile.close();									//closes file

			numbercounter--;								//counts down how many numbers put in

		}while(numbercounter>=1);							//ends asking for numbers
}


void readnumbers(ifstream& outfile,double numbers, double& total)
{
	outfile.open("numbers_file.txt");						//opens file
	outfile>>numbers;										//reads numbers
	total+=numbers+0;										//calculates total from numbers input
	cout<<"The total of the numbers is: "<<total<<endl;
	
}