CISC 3110 - Assignment #5 - Strings and Files

Part A: C-Strings

Write a program that checks whether the password that a user enters is a valid password.
Password rules:
  1. The password must be at least 7 characters long.
  2. The password must contain at least:
  3. The password must not contain spaces.
  4. The password must not begin with a dollar sign [$] or an asterisk [*].
  5. The first 2 characters of the password must not be the same character.
Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn't, the program should display a message telling the user why.

Delegate different tasks to different functions so your code is clear and easy to follow!

Part B: Files

Modify your program to begin by asking the user to enter a filename. The file will contain a set of passwords, separated by semicolons. Your program should go through the list of passwords in the file and determine if each one is a valid password or not. Update the file so that it lists each password and its validity. If the password is invalid, state why.

The contents of the file, when it is loaded by the program should be a set of passwords, separated by the semicolon character [;]. When the program is finished running, the file should contain the passwords, along with statements of explanation.

Sample input:

	notgood; pass1*co; *good12u

Sample output:

	notgood 
	Invalid: no numeric character.

	pass1*co
	Valid password.

	*good12u
	Invalid: begins with *.

Remember: The main input and output are stored in files. Do not use console input and output.