Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <string>
- #include <iostream>
- using namespace std;
- double summa(ifstream file)
- {
- int i;
- double input, sum = 0;
- for (i = 0; !file.eof(); ++i) {
- file >> input;
- sum += input;
- cout << input << endl;
- }
- return sum;
- }
- int main()
- {
- string path;
- getline(cin, path);
- int i;
- for (i = 0; path[i]!='\0'; ++i) {
- if (path[i] == '\\') {
- path[i]= '/' ;
- }
- }
- cout << path << endl;
- ifstream file;
- file.open(path);
- double value = summa(file);
- file.close();
- cout << value << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement