现在的位置: 首页 > 综合 > 正文

Online Judge 警示录

2013年04月16日 ⁄ 综合 ⁄ 共 404字 ⁄ 字号 评论关闭

 

1.while(add=bfs()!=-1) 这句在OJ里不是普通想像的那种。。。需while((add=bfs())!=-1)

struct重载输入符

#include "iostream"
using namespace std;
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node 
{
int x;
char c;
 node(int x,char c)
{
    this->x=x;
	this->c=c;
}
node()
{}
};
istream &operator>>(istream &in,node &x)
{
	cin>>x.x>>x.c;
	return in;
}
ostream &operator<<(ostream &out,node &x)
{
	cout<<x.x<<" "<<x.c<<endl;
	return out;
}
int main()
{

	node x;
	cin>>x;
	cout<<x;
}

 

抱歉!评论已关闭.