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

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

CodeBeauty

5 лет назад

28,996 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@MrPrince750
@MrPrince750 - 24.09.2020 13:45

When shall we use void main() compared to int main()?

Ответить
@KAIzoKUxxx
@KAIzoKUxxx - 25.11.2020 14:03

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

Ответить
@richardowusubanahene495
@richardowusubanahene495 - 22.12.2020 06:07

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.

Ответить
@kakoozaazizi8131
@kakoozaazizi8131 - 03.01.2021 01:16

thanks a lot . so so educative🤩 👌🏿

Ответить
@christianmaverickbautista6271
@christianmaverickbautista6271 - 17.02.2021 20:03

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";

Ответить
@ChrisVideosGreek
@ChrisVideosGreek - 25.02.2021 01:20

l'm just wonder... what do() will do if it won't have the while() inside...

Ответить
@gelilatesfaye6572
@gelilatesfaye6572 - 10.03.2021 14:00

I think this works better
do
{
cout<< "PIN: ";
cin >> pin;
if (pin == usersPin)
cout<<"LOADING......."<<endl;
else
errorCounter++;
}while( pin != usersPin && errorCounter < 5);
if( pin != usersPin)
cout<<"BLOCKED....."<<endl;

Ответить
@cuol5675
@cuol5675 - 15.03.2021 19:38

Very nice ! i love it

Ответить
@bmpersonal6403
@bmpersonal6403 - 18.04.2021 07:10

instead of:

if (errorCounter < 3) {
cout << "Loading..";
}

can we write:

if (errorCounter < 3 && usersPin == pin) {
cout << "Loading..";
}

Ответить
@mohammadasaad885
@mohammadasaad885 - 22.04.2021 14:11

This is a great video 📸.
How can i compute sinhz from this equation : z^(2k+1) /(2k+1)! =Sinhz on c++ 🧐

Ответить
@Daro_-uk4tl
@Daro_-uk4tl - 18.05.2021 00:12

as usual interesting

Ответить
@itiswhatitis7921
@itiswhatitis7921 - 01.06.2021 14:07

Wow thanks for this.

Ответить
@aasifali9139
@aasifali9139 - 21.06.2021 07:17

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

Ответить
@theRogueAvian
@theRogueAvian - 24.06.2021 10:54

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?

Ответить
@AlbertoGuitarrista
@AlbertoGuitarrista - 01.07.2021 22:30

I will express this the Java way:

while(watchingHerVideos == true){

try{

keepEyesOnTheCode();

}catch(Exception e){

System.out.println("I can't. She's too beautiful");

}

}

Ответить
@dosantos4022
@dosantos4022 - 04.08.2021 23:24

Hello am new here. Thanks for all. Please I need your assistance.

Ответить
@u.p.n1203
@u.p.n1203 - 05.09.2021 19:40

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

Ответить
@mhdjaseem3195
@mhdjaseem3195 - 09.09.2021 12:56

thanks, mam💕💖

Ответить
@gamingvideos767
@gamingvideos767 - 14.09.2021 21:22

thanks

Ответить
@muradshirinli710
@muradshirinli710 - 16.09.2021 09:46

6,20 "and"👍😊

Ответить
@kelvinvelazquez1172
@kelvinvelazquez1172 - 21.09.2021 00:14

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

Ответить
@rktvpt
@rktvpt - 10.11.2021 21:40

Hey, if i wanted to add something that tracks the errorCounter value and links it to a cout<< "x attempts left"; How should i do it?

Ответить
@isaabe8769
@isaabe8769 - 28.11.2021 11:28

thank you very much indeed ! it is so amazing tutorial

Ответить
@ConsistentForce
@ConsistentForce - 22.12.2021 13:44

IS this true ?
int PIN = 1234,counter=0,x;
do {

cout << " Enter Your Pin :";
cin >> x;
if (PIN == x)
{
cout << "corect";
break;
}
counter++;
} while (counter <= 3 );
if (PIN != x)
{
cout << "Blocked";
}

Ответить
@OMG_Tv143
@OMG_Tv143 - 30.01.2022 13:57

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

Ответить
@Fantino502
@Fantino502 - 16.02.2022 23:12

Hello guys, I have a logic question. I added 3 chances countdown user text in the code. Here is the code:

int main()
{
string userName;
int userPin = 55, pin, countError = 3;

cout << ":: OUTER HEAVEN MOTHER BASE ::\n\nEnter your username, please: ";
getline(cin, userName);

do {
cout << "\nEnter your PIN: ";
cin >> pin;

if (pin != userPin) {
countError--;
if (countError > 0)
cout << userName << ", you have " << countError << " remaining attempts." << endl;
}

} while (countError > 0 && pin != userPin);

if (countError > 0) {
cout << "\nWelcome to Outer Heaven Mother Base, " << userName << "! The page is loading..." << endl;
}
else {
cout << "\nYou have failed all 3 attempts, " << userName << ". Your account has been blocked." << endl;
}

// Clear Local Windows Debugger
system("pause>0");
}

-----------------------------------------------------------------------------

Despite it being right, I am not able to understand why a specific part of the IF is logic right.

if (pin != userPin) {
countError--;

// If I remove this part

if (countError > 0)
// If I remove this part

cout << userName << ", you have " << countError << " remaining attempts." << endl;


the text is going to say: "you have 0 remaining attempts" instead of skipping to \nYou have failed all 3 attempts, " << userName << ". Your account has been blocked".
Why do I need this part to avoid that message? My gosh, I hope my text doesn't are a mess! Thank you

Ответить
@momomunsta8887
@momomunsta8887 - 19.02.2022 01:40

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!

Ответить
@digitalturan
@digitalturan - 16.03.2022 17:44

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

Ответить
@richkidbarotse3984
@richkidbarotse3984 - 20.06.2022 02:24

But how is 3<3 in the code instead of 3<=3?

Ответить
@SpiralInstallGGSF
@SpiralInstallGGSF - 10.09.2022 00:19

Comment for Algor

Ответить
@yobro._.0
@yobro._.0 - 28.10.2022 18:13

You have such beautiful tits. Do you have onlyfans?

Ответить
@40wattstudio41
@40wattstudio41 - 01.02.2023 02:50

Fun project! I might expand on this one later.

Ответить
@tahabozyil9080
@tahabozyil9080 - 14.03.2023 02:49

could we do this with for

Ответить
@silvesterakon3684
@silvesterakon3684 - 15.03.2023 08:00

Why are you using void here not int?

Ответить
@soldiers4christ495
@soldiers4christ495 - 08.04.2023 17:57

HEYYYY never mind fixed it......🙃

Ответить
@jerseychou4323
@jerseychou4323 - 26.04.2023 12:57

Thank you my C++ teacher.

Ответить
@Geoffroxx
@Geoffroxx - 18.11.2023 04:43

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";

Ответить
@Dharm.a
@Dharm.a - 19.11.2023 03:40

❤’u

Ответить
@vijayshankarshukla3184
@vijayshankarshukla3184 - 26.11.2023 14:33

Why are you used here void main() function?

Ответить
@jamieMcSorley-c4i
@jamieMcSorley-c4i - 29.06.2024 20:36

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

Ответить
@alabikehinde5582
@alabikehinde5582 - 20.08.2024 16:03

Thanks I used this to upgrade my source code from the guessing game tutorial

Ответить
@ROYALNIL_SITE
@ROYALNIL_SITE - 29.09.2024 20:20

nice, continue learning with this good method

Ответить
@sabalah.sataleh
@sabalah.sataleh - 13.05.2025 22:33

1

Ответить