Код: Выделить всё
#include
#include
#include
#include
using namespace std;
int main(){
int K;
string commands;
fstream fileIn("robotin.txt");
fileIn >> K >> commands;
fileIn.close();
int updown = 0;
int sides = 0;
for(char i : commands){
//cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78917016/variable-data-gets-cleared-to-value-of-0-at-the-end-of-every-for-loop-iteration[/url]