#define _CRT_SECURE_NO_WARNINGS
#include <cstdlib>
#include <stdio.h>
#include <string.h>
int main()
{
float a, b, c;
char str[100]; //输入的字符串
char preStr[100];//运算符前的字符串
char endStr[100];//运算符后面的字符串
//scanf("%f%c%f", &a, &x, &b);
printf("请输入字符串:");
scanf("%s", str); /*输入参数是已经定义好的“字符数组名”, 不用加&, 因为在C语言中数组名就代表该数组的起始地址*/
int index = -1;
for (int i = 0; i < strlen(str); i++)//确定运算符的位置
{
switch (str[i])
{
case'+':index = i; break;
case'-':index = i; break;