Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- ifstream f;
- int arr[10];
- int sum = 0;
- f.open("C:\\sum.txt", ios::in);
- if (f.is_open()) {
- for (int i = 0; i <= 9; i++) {
- cout << "Введите " << i + 1 << " число:";
- cin >> arr[i];
- }
- for (int i = 0; i < 10; ++i) {
- sum += arr[i];
- }
- }
- ofstream fin;
- fin.open("C:\\sum.txt");
- fin << sum;
- fin.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement