Develop a function Length to find the length of input register number size is 7 to be fixed. If the size of the register number is less than or greater than 7, it should be “Invalid” otherwise “Accepted”.
#include <iostream>
using namespace std;
bool CheckRegisterNumber(int n) {
if (n >= 10000000 || n < 1000000) {
cout << "Invalid" << endl;
return false;
}
cout << "Accepted" << endl;
return true;
}
int main() {
int n;
cout << "Enter register number: ";
cin >> n;
CheckRegisterNumber(n);
}
Comments