Sunday, July 12, 2009

In an array of float variables, how can I find if there is an operator in the array? this is in C.?

I have a float array where the user inputs the variables that are to go into the array. These variables are to have arithmetic operations done to them. So how can I detect if the user entered a "+" for instance, so to add the float numbers of the array in C?

In an array of float variables, how can I find if there is an operator in the array? this is in C.?
This is not possible in a single array at all bcz there are two things to notice about. One you said that the array you declare is in float type, thus it is not possible to store a character in an float variable. Second if you declare the array as a char type then you can't put a real number there according to the character definition.
Reply:array of float does not hold operators for that u have to use character array and convret no. into float at calculation
Reply:char c;


cin%26gt;%26gt;c;





if(c=='+')


{do whatever you have to do here}


No comments:

Post a Comment