I have been reading that for portatbility reasons it's best not to use system("pause") to pause the program to view the ouput. But for this program cin.get() doesn't pause the program. Any ideas why? BTW, this program is a simple program to generate passwords based upon the number of characters the user wants it to be.
If I comment out the system("pause") it doesn't pause.Code:#include <iostream> #include <string> #include <cstdlib> #include <time.h> int main() { int passwordLength = 0; std::string password;// = ""; time_t seconds; time(&seconds); srand((unsigned int) seconds); std::cout<<"Enter the desired length for the password: "; std::cin>>passwordLength; for(int i = 0; i < passwordLength; i++) { int num = rand()%75 + 48; if(num >= 48 && num <= 122) //only want certain characters in pthe password { char c = (char)num; password += c; } else i--; } std::cout<<"Password is: " <<password<<std::endl; std::cin.get(); system("pause"); }