Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96101163
body.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 22, 15:12
Size
1 KB
Mime Type
text/x-c
Expires
Tue, Dec 24, 15:12 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
23120700
Attached To
rSTICAZZI yearII_reports
body.cpp
View Options
#define _USE_VECTOR_OSTREAM // allows vector
#include "body.h"
#include <istream>
#include <ostream>
using namespace std;
istream& operator>>(istream& is, Vec2D& v)
{
char delim;
is >> std::skipws;
is >> delim;
if (delim != '(')
throw '(';
is >> v[0];
is >> delim;
if (delim != ',')
throw ',';
is >> v[1];
is >> delim;
if (delim != ')')
throw ')';
return is;
}
istream& operator>>(istream& is, Body &body)
{
is >> std::skipws;
char delim;
// begin
is >> delim;
if (delim != '{')
throw '{';
is >> body.m;
is >> delim;
if (delim != ',')
throw ',';
is >> body.x;
is >> delim;
if (delim != ',')
throw ',';
is >> body.v;
is >> delim;
if (delim != ',')
throw ',';
char fix;
is >> fix;
body.fixed = (fix == 'T');
// end
is >> delim;
if (delim != '}')
throw '}';
is >> std::noskipws;
}
ostream& operator<<(ostream& os, const Body &body)
{
os << "{" << body.m << ", " << body.x << ", " << body.v << ", " << body.fixed << "}";
return os;
}
Event Timeline
Log In to Comment