Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream fin("C:\\testing\\test.txt");
- if (fin.is_open())
- {
- int *mass = new int[10];
- int i = 0;
- while (fin >> mass[i])
- {
- i++;
- }
- int m = i;
- int sum = 0;
- for (int j = 0; j < m; j++)
- {
- cout << mass[j] << " ";
- sum += mass[j];
- }
- cout << endl;
- cout << sum << endl;
- fin.close();
- delete[] mass;
- }
- else
- cout << "File ne naiden." << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement