Only read 2 letters and 4 numbers in C [on hold]

问题内容:

I’m creating a program in C as a homework for college. In this project the user has to add packages and vehicles for a company. I need the user to enter a unique license plate for each vehicle, but the license plate can only have 2 letters and 4 numbers. I’m thinking this should be done with a do..while… But I’m not really sure how to verify letters. I do know that for numbers it’s gotta be x < 0. It’s killing me because I don’t have a clue on how to do it with standard functions.

问题评论:

4  
Any code you’ve attempted so far would be helpful.
    
As @MatthewDarnell said, try writing some code first, then if you come across a specific issue, post it here.
    
Correct. That’s something like do { scanf in var, if var contains 2L+4N ok=1 else ok = 0 } while ( ok == 0) then for uniqueness, you need an array of strings, and compare the new value with all currently in array. Do it!

原文地址:

https://stackoverflow.com/questions/47746890/only-read-2-letters-and-4-numbers-in-c

Add a Comment