C++ FOR BEGINNERS (2020) - Do while loop, Difference between while and do while PROGRAMMING TUTORIAL

preview_player
Показать описание
What is do while loop and how is it used?
What are the differences between while and do while loops?
In this video I'll explain on a simple example how and when is do while loop used.

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️

Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
It is a powerful, secure text editor designed specifically for programmers.

However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇

Contents:
00:00 - Intro
13:43 - What is the difference between while and do while loop?

While loop videos:

Follow me on other platforms:

*******CODE IS IN THE COMMENTS*******
Рекомендации по теме
Комментарии
Автор

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

#include <iostream>
using namespace std;

void main()
{
int usersPin = 1234, pin, errorCounter = 0;//3

do {
cout << "PIN: ";
cin >> pin;
if (pin != usersPin)
errorCounter++;
} while (errorCounter<3 && pin!=usersPin);

if (errorCounter < 3)
cout << "Loading...";
else
cout << "Blocked...";

system("pause>0");
}

CodeBeauty
Автор

who else noticed the "and" at 6:20 :p
this shows how much she is committed into helping us learn efficiently
thanks alot code beauty
this channel helped me alot to get through my finals at uni

diaz
Автор

I'm so thankful I found this channel, because it simple and clear to understand how they explain the program

OMG_Tv
Автор

thank you very much indeed ! it is so amazing tutorial

isaabe
Автор

thx a lot for this video. it cleared all my doubts.

aasifali
Автор

Fun project! I might expand on this one later.

wattstudio
Автор

I added the ability to choose your pin aswell as telling the user how many attempts they have left! These tutorials have been so useful and easy to learn from. Thanks you!

momomunsta
Автор

This application is very useful, we can even access our very sensitive data using
Great

IAmIshanSaxena
Автор

Great explanation and easy to understand. You should really consider to be a full time lecturer. I would love to be your student😁

KAIzoKUxxx
Автор

Hi, Ms. code! I'm an aspiring game developer and am attempting to learn C++. Currently, I watch your vids, because they are the most up-to-date tutorials I can find and I find your way of teaching very comprehensible. I usually attempt to create the program right after you give the general discussion, and would like to know if my codes are passable.

int pin, input, attempts = 0;

cout << "Creat PIN: ";
cin >> pin;
attempts += 3;
system("CLS");

do {
cout << "Enter PIN: " << endl;
cout << attempts << " attempts left" << endl;
cin >> input;


attempts--;
system("CLS");
if (pin == input)
cout << "Account accessed";
} while (pin != input && attempts > 0);

if (attempts == 0)
cout << "Access Denied";

christianmaverickbautista
Автор

I love how she teaches really friendly smoothly and lovely she is better than our programming lecturer 🥰😍

u.p.n
Автор

Hello, i am getting the concept now but for the while loop on reversed number i don't get well and this is due to some of the source codes declared example int lastDigit = number % 10; and number = number / 10;. can you explained better for while these. Thank you.

richardowusubanahene
Автор

Marry me :D Šalim se, puno pozdrava za tebe, studirao sam na FIT-u i jednim dijelom savladao C++ ali me posao odveo u drugom smjeru tako da sam zapostavio. Ovo će mi svakako dobro doći da osvježim zaboravljeno znanje. Puna podrška & keep it up!

downtheline
Автор

Hey Saldina. I have a question. i was trying to run do while loop in eclipse. and its showing error and not taking void main() instead asking for int main() while your code ran without any errors. i copid the same code as yours. what is happening?

Zaphee
Автор

İ did not get why we have not used curly brackets in if...else

digitalturan
Автор

Hi, im entering competitive programming and i've heard that the best language for it is C++, until what kind of certain level of the C++ language to be able to get comfortable with Competitive Programming?

francisc.t.
Автор

In this program I assigned a pin for the user, Pin :1234, I want the user to put the pin and the program creates memory, or assigns a memory when the program runs again, so the user does not need to enter the pin again

kelvinvelazquez
Автор

I noticed if I enter a letter or a symbol, the program immediately runs through the code asking to enter the pin, but doesn't allow a pin to be entered, then the program defaults to "Blocked". Is there a way to debug this? I was thinking of using another if statement

jamieMcSorley-ci
Автор

Why are you used here void main() function?

vijayshankarshukla
Автор

When I type in else it throws an error even if I have typed in the code verbatim to yours, int userPin = 1234, pin, errorCounter = 0;

do{
cout << "PIN:";
cin >> pin;
if (pin != userPin)
errorCounter++;

} while (errorCounter< 3 && pin!= userPin );

if (errorCounter < 3);

cout << "Loading";

else

cout << "Blocked";

Geoffroxx