/* #include<iostream> */ /* int main() */ /* { */ /* //let us write a program to find factorial of an integer. */ /* unsigned long long int n=60; */ /* /1* std::cout<<"Enter the number to find factorial"<<std::endl; *1/ */ /* /1* std::cin>>n; *1/ */ /* int product=1; */ /* for (int i=n; i>0; i--) */ /* { */ /* product*=i; */ /* } */ /* std::cout<<"the factorial is "<<product<<std::endl; */ /* } */ //let us write a code for while loop now: /* *************************WHILE LOOP***************************************** */ /* #include<iostream> */ /* using std::cout; */ /* using std::endl; */ /* int main() */ /* { */ /* int n=5; */ /* int product=1; */ /* while(n>0) */ /* { */ /* product*=n; */ /* n-=1; */ /* } */ /* cout<<"factorial of 5 is "<<product<<endl; */ /* } */ /******************************DO while loop****************************************** *It is used when we want to do something at least once. like running a loop untill some condition is met. */ #include<iostream> using std::cout; using std::cin; using std::endl; int main() { std::string passwd="Password123"; std::string guess; do { cin>>guess; cout<<"Enter the guess again"<<endl; }while(guess!=passwd); }