How do I fix my calculater
Hello! I've been working on a 1 input calculater so you'll be able to do for example 7*5+3 and it will soulve it currectly I have a code, that code only works if you do for example 7*5*3 or 7+5+3+4 or 7-7-2-3 it only works if you do 1 oprator on it I'd really like someone to help me and fix it so you'll be able to do more oprations not just one this is the code: // calculater 1.0 // works only with + // made by Raz #include <algorithm> #include <iostream> #include <string> #include <sstream> using namespace std; int main() { string numbers = ""; int first = 0; int second = 0; int total = 0; int count = 0; int partplus = 0; int totalplus = 0; int totalminus = 0; int totalmulti = 1; int totaldev = 0; int third = 0; string str; cout << "Please enter the numbers " << endl; // 15+32 getline(cin, numbers); for (int i = 0; i < numbers.length(); i++){ str = str + numbers[i]; // 5+3-2+5 // 8,1,3 int first = stoi(str); int second = stoi(str); int third = stoi(str); if (numbers[i] == '+') { totalplus = totalplus + first; // 0=0+5 str = ""; } if (numbers[i] == '-') { count++; if (count == 1) { second = second*-1; } totalminus = totalminus-second; str = ""; } if (numbers[i] == '*') { totalmulti = totalmulti * third; str = ""; } } // plus case its just totalplus so its just in plus first = stoi(str); second = stoi(str); third = stoi(str); totalplus = totalplus + first; totalminus = totalminus -second; totalmulti = totalmulti * third; cout << totalplus<< endl; cout << totalminus<<endl; cout << totalmulti << endl; // can not be more than 11 numbers at ones }