Im not able to print with this serial no "318-356-082" with below code.Please can any one tell this Answer where I did the mista
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include<iostream> #include<algorithm> using namespace std; int main() { // Comparing ASCII values of a and b cout << "Hi" <<std::max(0,2) << "\n"; std::string device; bool filter= true; device = "V240m B-FF 318-356-082"; if((filter == true) && !device.empty()) { const char snLength = 11 ; // xxx-xxx-xxx char sn[1 + snLength] = { 0 }; cout<< device <<endl; const char* const snFormat = "%3u-%3u-%3d"; int b1, b2, b3; for(int i = 0; i <= std::max(0, (int)device.size() - snLength); i++) { if(!isdigit(device[i])) continue; if( sscanf( device.substr(i, snLength).c_str(), snFormat, &b1, &b2, &b3) < 3) continue; sprintf(sn, snFormat, b1, b2, b3); device= sn; cout<< device <<endl; break; } //if(!sn[0]) continue; } else { cout<<"Faile"<<endl; } // Returns the first one if both the numbers // are same // cout << std::max(7,7); return 0; }