How does reading data with >> work inside a while loop in C++?
#include
#include
using namespace std;
int main(){
fstream File("input.txt");
string line;
float surface_area ;
char x;
int l;
int w;
int h;
while (File>>l>>x>>w>>x>>h) {
cout<< l<
note:- i just printed values to check whether its working or not.
I am new to C++ (1yr).
I have bunch of questions regarding this program:-
- how this snippet works: while (File>>l>>x>>w>>x>>h){}
- when i trying to read from
input.txt,its skipping the first line even though there is a value! - how string is getting converted into int/float for value of l,w,h ?
- are/is there any other way/s to read massive input (1kloc)?