33,311
社区成员
发帖
与我相关
我的任务
分享
#ifndef GET_H_INCLUDED
#define GET_H_INCLUDED
extern istream &get(istream& gt)
#endif // GET_H_INCLUDED
#include <iostream>
#include <stdexcept>
#inlucde "get.h"
using namespace std;
istream &get(istream& gt)
{
string a;
while(gt>>a)
{
if(gt.bad())
throw runtime_error("iostream is corrupted");
cout<<a<<endl;
}
return gt;
}
#include <iostream>
#include "get.h"
using namespace std;
int main()
{
double ival;
get(cin);
cin>>ival;
cout<<ival;
return 0;
}
// get.h
#ifndef GET_H_INCLUDED
#define GET_H_INCLUDED
#include<iostream>
using std::istream;
istream &get(istream& gt);
#endif // GET_H_INCLUDED