char fileName[100];
cout <<" please enter the name of the data file "<< endl;
cin>>fileName;
ifile.open(fileName);

1 how to put data in the filename
(how to put numbers in the filename
e.g lets name it sample.txt
where to put this sample to be readen by the program

2. how to read the numbers from the file name

in the problems i dont know how to do it like how to read from file and calculate the average

thanks in advance

google search ifstream cplusplus.com will tell you all about it with example code. Also put you code in code tags, no a huge deal for that small bit of code but can make it harder to read.

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.