Question #191986

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”.


1
Expert's answer
2021-05-11T10:00:56-0400
#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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS