Confusion regarding insertion and Extraction operator [closed]

  c++

I am CONFUSED regarding use of << and >>.

In case of cin we use >>, which basically means input.

In case of cout we use <<, which basically means output, but in case of ifstream and ofstream why is not similar?

#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
ifstream f("input.in");
ofstream g("output.in");
int main()
{
    string s;
    f>>s;
    cout<<s;

/*
cin>>kk;
cout<<kk; 
f>>kk; -------------> CONFUSED
f<<kk;
*/
}

I’ve tried to find an answer online but I haven’t found much so far.

Source: Windows Questions C++

LEAVE A COMMENT