43 lines
782 B
C++
43 lines
782 B
C++
|
#include <fstream>
|
||
|
#include <sstream>
|
||
|
#include <iostream>
|
||
|
#include <iomanip>
|
||
|
#include <vector>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
std::string filename("data.txt");
|
||
|
std::ifstream input{filename};
|
||
|
|
||
|
int prev = 0;
|
||
|
int current = 0;
|
||
|
int counter = 0;
|
||
|
|
||
|
if(!input.is_open())
|
||
|
{
|
||
|
std::cerr << "Couldn't read file: " << filename << "\n";
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
for (std::string line; std::getline(input, line);)
|
||
|
{
|
||
|
if (prev == 0)
|
||
|
{
|
||
|
prev = std::stoi(line);
|
||
|
continue;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
current = std::stoi(line);
|
||
|
|
||
|
if (prev < current)
|
||
|
{
|
||
|
counter ++;
|
||
|
}
|
||
|
|
||
|
prev = current;
|
||
|
}
|
||
|
}
|
||
|
std::cout << counter << std::endl;
|
||
|
|
||
|
}
|