Misc. Functions (Part 2).
By SalimMeghani
- 219 reads
// Find a bracket.
int isbracket(char c)
{
if (c=='('||c==')') return 1; else return 0;
}
// Find a decimal point.
int isstop(char c)
{
if (c=='.') return 1; else return 0;
}
// Find an operator.
int isoperator(char c)
{
switch(c)
{
case '*':return 1;
case '+':return 1;
case '-':return 1;
case '/':return 1;
default : return 0;
}
}
int moreops(char *c)
{
int loop=0;
for (loop=0;loop<=strlen(c);loop++)
{
if ((c[loop]=='E')) return(0);
else if ((loop>0) && (c[loop]=='*' || c[loop]=='/' || c[loop]=='+' || c[loop]=='-' || c[loop]=='(' || c[loop]==')' )) return(1);
}
return(0);
}
- Log in to post comments