Skip to content

Repository files navigation

Age Verification System (C++)

The Age Verification System is a simple C++ console application that verifies a user's age and determines whether they meet the required age based on user input. The program accepts the user's age, compares it to the minimum required age, and displays whether the user is eligible or not.

Technologies Used

  • C++
  • Visual Studio Code
  • C++ Standard Library (iostream)
  • C++ Standard Library (string)

Concepts Used

  • Variables – Used name and age variables to store user information.
  • User Input and Output – Used getline() to read the user's name, cin to accept the user's age, and cout to display messages.
  • Conditional Statements – Used an if-else statement to determine whether the user is an adult or a minor.
  • Comparison Operators – Used the >= operator to compare the user's age against the minimum required age of 18.
  • Strings – Used the string data type to store and display the user's name.

The Process

  • Display a welcome message and program title.
  • Ask the user to enter their name.
  • Ask the user to enter their age.
  • Compare the entered age with the minimum required age (18).
  • If the user is 18 or older, display their status as Adult and show a personalized welcome message.
  • If the user is under 18, display their status as Minor and inform them that they cannot enter.

What I Learned

  • How to declare and use variables in C++.
  • How to accept text input using getline().
  • How to accept numeric input using cin.
  • How to use if-else statements for decision-making.
  • How to compare values using comparison operators.
  • How to display personalized output using variables.

How It Could Be Improved

  • Validate user input to prevent invalid or negative ages.
  • Allow users to perform multiple age checks without restarting the program.
  • Handle invalid inputs such as letters entered for the age.
  • Add different age classifications (Child, Teenager, Adult, Senior).

How to Run the Project

  • Step 1: Open the project in Visual Studio Code or any C++ IDE.
  • Step 2: Compile the program using a C++ compiler.
  • Step 3: Run the program.
  • Step 4: Enter your name when prompted.
  • Step 5: Enter your age.
  • Step 6: View the verification result.

Sample Output

image alt image alt

About

A simple C++ console application that verifies a user's age and determines if they meet the required age based on user input.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages