User Tools

Site Tools


c_-_c_streams:defining_own_istream

C - C++ Files - Defining own istream

#include<iostream>
 
#include<string>
using namespace std;
 
istream & get(istream &v)
{
  char c;
  v>>c;
  return v;
}
 
 
int main()
{
  char var[80];
  cout<<"Enter some characters:";
  cin>>get>>var;
  cout<<"After storing first character in stream:";
  cout<<var<<'\n';
  return 0;
}
c_-_c_streams/defining_own_istream.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki