Hi, I get an error in the following code on line 9: 'ios' has not been declared. I'm using a Code::Blocks IDE if that helps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <fstream>
int main()
{
std::ifstream read("List.txt");
int x;
while (read >> x)
std::cout << x << std::endl;
std::ofstream print("List.txt", ios::app);
do
{
std::cin >> x;
if (x)
print << x << std::endl;
}
while (x);
}
If anyone has any idea why this doesn't work, please let me know, thanks!
#include <iostream>
#include <fstream>
int main()
{
std::ifstream read("List.txt"); // Потік щоб читати і писати з / у файли
int x;
while (read >> x)
std::cout << x << std::endl;
std::ofstream print("List.txt", std::ios::app); // Потік писати на файли
do
{
std::cin >> x;
if (x)
print << x << std::endl;
}
while (x);
}