Help me >>

Nov 1, 2013 at 5:58pm
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.
Nov 1, 2013 at 5:59pm
closed account (Dy7SLyTq)
what do you have so far
Nov 2, 2013 at 3:37am
i don't know how to do it. Please help me. thanks
Nov 2, 2013 at 5:06am
can i give an example instead?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <fstream>     ///header file for ifstream and ofstream
#include <iostream>
using namespace std;

main(){
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

return 0;
}


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)




Last edited on Nov 2, 2013 at 5:09am
Nov 2, 2013 at 7:49am
please do this exercise for me fully.
Nov 2, 2013 at 10:53am
please do this exercise for me fully.


If you don't make any code, you won't learn anything, you can try and post what you've done, we are willing to help ...

~~~~~~~~~~~~~~~~~~~~~~~~~~~

by the way do you already have the text file so we can advance ?
Last edited on Nov 2, 2013 at 10:53am
Topic archived. No new replies allowed.