Task:

The main part of the automobile state registration number consists of 6 characters: three letters and three numbers. First comes the letter, then 3 digits and 2 more letters end the recording. Any numbers from 0 to 9 can be used as numerals, and only capital letters as letters, the designations of which are present in both English and Russian alphabet, i.e. Only the following characters: A, B, C, E, H, K, M, O, P, T, X, Y. For example, “P204BT” is the correct number, and “X182Yx” and “ABC216” are not. Determine whether the entered number is correct.

There is such a code, converted to Windows form. Writes that find is not a member of the class (screenshot 1). How can I fix the error?

private: System::Void MyForm_Load(System::Object^ sender, System::EventArgs^ e) { } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { const String^ buk = "ABCEHKMOPTX"; const String^ cif = "0123456789"; String^ s = System::Convert::ToString(textBox1->Text); if (s->Length == 6 && buk->find(s[0]) != -1 && cif->find(s[1]) != -1 && cif->find(s[2]) != -1 && cif->find(s[3]) != -1 && buk->find(s[4]) != -1 && buk->find(s[5]) != -1) { String^ k = "Верный"; textBox2->Text = System::Convert::ToString(k); } else { String^ k = "Неверный"; textBox2->Text = System::Convert::ToString(k); } } 

mistake

The form itself looks like this

  • There is no find method among the methods of the String class. - Alexander Petrov
  • How then would it be better to rewrite? Maybe there are ideas ... - llatibro
  • Maybe a little bit wrong. Here find is most likely to play the role of a function rather than the method - llatibro

0