Make a .txt file has student information: Rollnumber, Fullname, Avaragenumber. Write C++ program, filter the students that have 5<= avaragenumber <=7 and then wtire result to "out.txt" from little to big.
thanks for help.
#include <fstream> ///header file for ifstream and ofstream
int x, y,z;
ifstream in("file.txt"); ///gets input from file.txt ( for other files, just type
/// the filename inside the "", "in" is just a word
///used as a substitute for "cin". you can use
/// other words so long as it isnt a reserved word.
ofstream out("out.txt"); ///outputs to another .txt file
in>>x>>y>>z; ///gets 3 inputs in file.txt. we used "in" because
///thats the variable we used in getting file.txt
out<<x<<y<<z; ///outputs the 3 inputs from file.txt to out.txt
you do know how to code it using cin and cout right?
note: if your thinking why the cmd doesnt output anything, its not supposed to, the outputs (x, y, z) are supposed to be in a txt file (in here, its out.txt) . ur file should also be in the same folder as your code (both in ifstream and ofstream)