newfile.open("in.txt", ios::in);
The above line can be modified to use the absolute path(instead of the relative path,right now).
eg newfile.open("./in.txt", ios::in); or newfile.open("/home/user/check/in.txt", ios::in);
Or you can place the in.txt file in same directory as the binary.
Or make sure the file in.txt exists !!
for reference:https://onlinegdb.com/PQ86gLPO8