Given the availability of an ifstream object named input wri

Given the availability of an ifstream object  named  input, write the other statements necessary to read an integer into a variable  datum that has already been declared from a file called rawdata. Assume that reading that one integer is the only operation you will carry out with this file. (Note: write just the statements , do not define a main function.)

Solution

Please let me know still you need more Information:-

========CODE STARTS=============

ifstream input; //declaration

int datum; //declaration

inupt = ... //open file rawdata

....... etc

while(input>>datum);//Here the integer value will be read to datum from filesream input

=========CODE ENDS======================

Now while to read a number from input of type ifstream you just need to read line by line if many values are there in file other wise you can read into one variable.

Thanks

Given the availability of an ifstream object named input, write the other statements necessary to read an integer into a variable datum that has already been de

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site