![]() For example, if your input is 2*3+1, you first calculate 2 × 3, which is okay, and then you calculate 3 + 1, which isn't okay: You want to calculate 6 + 1 here. That's bad.Īnother problem is that you always operate on two adjacent numbers, but that's not what you want. The index 2*loop -1 will go out of bounds on the first number. The + or + operator adds a function to the invocation list, and the - and. It is clear that the index 2 * loop can go out of bounds. A delegate that points multiple methods is called a multicast delegate. You have two independent arrays, one for numbers, one for operators. In ASCII that's 43.Ĭalculation: There is also a problem with how you calculate your result. The notation '+' means the character code of the plus sign. Double quotations marks enclose strings, that is pointers to the first character of an array of characters. COMPUTER OPERATIONS ( clerical ) chief console operator senior console. Strings versus characters: C distinguishes between single and double quotation marks. Automatic Data - Processing - Equipment Operators This group includes occupations. In that case, the next scanf starts before the unrecognized input, which will probably trip up your syntax. In computer science, the modulus operator and integer division are. "Nothing read" means that there is input, but it can't be converted to a number, for example "four". Addition, subtraction, multiplication, division, and exponentiation are core operations. You should also check the result, which would be 1 for "1 item read", 0 for "nothing read" ot EOF for "end of input", for example when the user hits Ctrl-D or Ctrl-Z. The operator &number_in creates such a pointer: scanf("%d", &number_in) // like above, but now on a correct number_in So scanf must store the scanned data by other means: You must pass a pointer to the data you want to scan. One way would be to return the scanned number, but scanf can read multiple inputs, so it chose to return a value that tells you whether the scanning was successful. When you read the input, the scanning function must be able to modify number_in. Your input is a whole number, an int, not a pointer to an int. To determine opeators, first I used switch case then tried If statement but both of them gave wrong results. Scanning the input: Your data input looks like this: int *number_in You can learn about some of them when you enable warnings. There are many problems with your program.
0 Comments
Leave a Reply. |