Log in from a computer to take this course

You'll need to log in from a computer to start Learn C++. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

So first up… the while loop!

Before we dive deep into the syntax of the while loop, let’s do a demo.

Inside enter_pin.cpp, we have a program that asks and checks for a password. It uses a while loop to ask the user for the password over and over again.

Note: You don’t need to understand the code right now.

Instructions

1.

Compile and execute using the terminal.

When the program asks you to Enter your PIN:, try the following:

Press 1111 and press enter.

Press 2019 and press enter.

Press 1234 and press enter.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?