Hi can someone please help me?
I have to place the following strings "pow", "sin","exp", "cos" in the array recieved as argument.
/*
* getop.c
*
* gets next token: operator or numeric operand
*/
#include <stdio.h>
#include <ctype.h>
#include "calc.h"
#define FCT '1' //$$ Returns a new symbolic constant
int getop(char s[])
{
int i, c;
while ((s[0] = c = getch()) == ' ' || c == '\t')
;
s[1] = '\0';
if (!isdigit(c) && c != '.')
return c; /* not a number */
********Modified part of code************
string p = "pow";
string e = "exp";
string s = "sin"; // Is this the correct way?
string c = "cos";
if( s[i] == p || s[i] ==e || s[i] == s || s[i] ==c)
return FCT;
*************************************
/* collect integer part in string s */
i = 0;
if (isdigit(c))
while (isdigit(s[++i] = c = getch()))
;
/* collect fractional part in string s */
if (c == '.')
while (isdigit(s[++i] = c = getch()))
;
s[i] = '\0';
if (c != EOF)
ungetch(c);
return NUMBER;
}