Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void secondTask() {
- // Числа в файле должны быть записаны в одной строке через пробел
- ifstream in("second.txt");
- string line;
- long long count = 0;
- getline(in, line);
- string temp = "";
- for (int i = 0; i < line.size(); i++) {
- if (line[i] != ' ') {
- temp += line[i];
- if (i == line.size() - 1) {
- count++;
- cout << stof(temp) << " ";
- }
- }
- else {
- count++;
- cout << stof(temp) << " ";
- temp = "";
- }
- }
- cout << "\nВсего чисел в файле: " << count << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment