[QUOTE]Here's a section of my calculator program -> the 1st calculator crash proof wasn't neccessary but now it is, so i gotta change it a bit. The problem is with the for loop, and where i do the if statement, i don't think i'm doing it properly, could someone point out the problem..thanks! (oh yea, i forget i'm trying to make it validate that the string has numbers only, and a deciamal point if present
Code:char strnum01[10] ; double num01 cout << "Addition (+)"; cout << "Enter a number: "; cin >> strnum01; for(int i=0; strnum01[i]; i++) { if(strnum01[i] = '1' || strnum01[i] = '2' || strnum01[i] = '3' || strnum01[i] = '4' || strnum01[i] = '5' || strnum01[i] = '6' || strnum01[i] = '7' || strnum01[i] = '8' || strnum01[i] = '9' || strnum01[i] = '.') num01 = double(strnum01); else cout << "Number input is invalid!"); }