Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(){
- ifstream myfile;
- double x;
- double sum = 0;
- char filename[50];
- cout <<"Enter the file name: ";
- cin.getline(filename,50);
- myfile.open(filename);
- if(myfile.is_open()){
- while(myfile >> x){
- cout << x << endl;
- sum += x;
- }
- cout << "result: " << x << endl;
- } else cout << "Error ocoured" << endl;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment