I'm trying to write a program that reads input from the user and then performs math on it, using spaces for to seperate the strings such as 1 + 1. I want the user to enter a q or Q to exit the program but I just can't figure out what I'm doing wrong.
do {
cout << "Enter a simple expression. Use spaces for seperation: ";
cin >> firstOperand >> mathSymbol >> secondOperand;
cout << endl;
maxIndex = ( firstOperand.size() + 1);
for ( index = 0; index < maxIndex; index++ ){
if ( firstOperand[index] == '.' ){
stringIsFloat = true;
}
}
I'm afraid a lot of us probably avoided this post for the following reasons:
1) Bad code formatting
2) No ["CODE"] tags used.
3) Long and extended code without pointing out the code in question which also may relate to code formatting and code tags.