i have sorted data in an array and sent to a file...how do i put this sorted data in a stack.

First, are you familiar with a stack and its methods?

If you are the process is simple. Based on what you have said,

while(!eof(yourfile))
{
fin >> temp;
stack.push(temp);
}

At the moment I am making the assumption you are familier with stacks and can declare the variables I used. If you don't let me know.

this is my code i need to get this array i sorted in this program to a stack then a que-within in this same main program

#include "c:\\ArrayTC_f04.h"
#include "c:\\StackArrC.h"
#include "c:\\QArrC.h"

void main()
{

	try
	{
		
		ifstream fin;
		ofstream fout;
		
		int arrsize;
		cout << "\nEnter array size ";
		cin >> arrsize;
		ArrayC<double> A(arrsize);
		fin.open("c:\\bankin.txt");
		if(!fin)throw FileException();
		fout.open("c:\\bankout.txt");
		if(!fout)throw FileException();
		fin >> A;
		cout << "array is \n" << A;
		cout<< " Sorted array " << endl;
		A.selectionSort();
        cout<<A<<endl;
		fout<<A<<endl;
		fin.close();
		fout.close();
		
		cout << endl;

	}
	catch(...){}
}

can anybody help me

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.