/*
* teradyne.h
*
* Created on: 2013-8-11
* Author: Administrator
*/
#ifndef TERADYNE_H_
#define TERADYNE_H_
#include <string>
#include <iostream>
using namespace std;
//给定一个表达式,判断'('和')'是否配对,如“ )+3(”是不配对的,若配对返回1,否则返回0
int match(const char *str)
{
int temp = 0;
while(*str)
{
if('(' == *str)
temp++;
if(')' == *str)
temp--;
if(temp<0)
{
return false;
}
str++;
}
if(0 == temp)
return true;
else
return false;
return 0;
}
#endif /* TERADYNE_H_ */