anyone is willing to give me a hint for my small program. My program is basically promote the user to enter 12 characters exactly.Then, the program will test this code in four conditions. These conditions are the following:
1. must be 12 characters //if this condition is completed, we test the second condition.
2. digits 4 and 5 must be used at least once //if this condition is completed, we test the second condition.
.
.
Once I can solve the second condition I will probably will be able to test all conditions. I am thinking to use the tokenizer to do the job but I am little confused in the way I use it. Anyone has an idea or a hint how to detect that the user has only used 4 or 5 at least once. let's say the user has entered this code: EP2V973D341L
Code:#include <iostream> #include <cctype> #include<string> #include <stdio.h> #include <stdlib.h> using namespace std; void newCode(); void printCode(); int main() { int tester; while((tester >= 1) || (tester < 3)) { cout << "select one of these options\n"; cout << "(1) Insert a new code\n"; cout << "(2) Print the data\n"; cout << "(3) Exit the program\n"; cin >> tester; if(tester==1) newCode(); else if (tester==3) cout << "GoodBye"; break; /*else if (tester==3) void exit ( int status ); else cout << "ERROR!!! You must choose one of the options from 1 to 3";*/ } return 0; } void newCode() { string serial_number; int length; cout<< "please enter a serial number of 12 characters:"; cin >> serial_number; length = serial_number.length(); if (length!=12 ) cout << "The code you have entered cannot be processed because the code must 12 characters exactly"; else cout << "The serial number is:" << serial_number<< endl; }