Not getting the meaning of error
#include <iostream> #include <string> using namespace std; class Binary { string s; public: void read(void) { cout << "Enter a binary number "; cin >> s; } void chck_binary() { for (int i = 0; i <= s.length(); i++) { if (s.at(i) != '0' && s.at(i) != '1') { cout << "Incorrect Binary Format" << endl; exit(0); } } } void ones(void) { for (int i = 0; i <= s.length(); i++) { if (s.at(i) == '0') { s.at(i) = '1'; } else { s.at(i) = '0'; } } } void display(void) { for (int i = 0; i <= s.length(); i++) { cout << s.at(i) << endl; } } }; int main() { Binary s; s.read(); s.chck_binary(); s.ones(); s.display(); return 0; } Error Enter a binary number 1000 terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::at: __n (which is 4) >= this->size() (which is 4) What is wrong ?? How to solve the error ?? What is the meaning of the error??