c - Is it possible to make an action that does line number "x" -
Let me explain myself, I do not know that this is possible, so I will write it in the phonetic code
while (position) {line number acts in x; X ++; } For example, if my code has the following line in line number 40: "printf (" hello ");" The program will print "Hello" and then check the status and if the situation is correct then it will take action in line number 41.
Instead of thinking of going / x line, perform and come back < / Code>, how do we create a group of some statements , to create some functions , call them one by one and do our job? feels good?
Ok, I give you an idea of how to do this, you will write code. Agree? : -)
- Take the first requirement [at least 1 point]. Write a function, say
int checkForDigit (const char * ip, int size), which will examine all the elements of the array [[code up to] and get it very moment One point, it will return to 0, otherwise, at the end, return 1. - Take another requirement, [at least one small-case letter] Write a function, say
int checkForSmallCase (const char * ip, int size)All the elements will check [[code up to- Continue to add different functions for different verification requirements
Now, in your code,
- define a flag variable , And set it to a default value, maybe
-1. - Take input of your password string , calculate size.
- Call the checkout function with password strings and length.
- Call each other valid work, one by one, and submit the return value in the flag.
Finally, if all validations are successful, the value of the flag will be 0 . Consider a valid password Otherwise, ask for a new password.
Comments
Post a Comment