Login Register






What is wrong with my C++ code? (Test login) filter_list
Author
Message
What is wrong with my C++ code? (Test login) #1
Hey guys, I recently started learning C++ and i tried making this simple login program but I can`t get char arrays with if statements correct. Please help.
Thank you,

Code:
#include <iostream> int main(){ char Array[20]; char Array2[20]; char yesorno; int boom = 1; do { std::cout << " Username:"; std::cin >> Array; std::cout << " Password:"; std::cin >> Array2; if (Array == "N1v3k" || Array2 == "myub3rlongpasswordhere"){ std::cout << "" << std::endl; std::cout << "Successful login, welcome." << std::endl; }else{ std::cout << "" << std::endl; std::cout << "Wrong username and/or password, would you like to try again?(y/n)" << std::endl; std::cin >> yesorno; if (yesorno == 'y'){ std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; std::cout << "" << std::endl; }else{ ++boom; } } } while (boom == 1); }

-N1v3k

Reply





Messages In This Thread
What is wrong with my C++ code? (Test login) - by N1v3k - 11-23-2011, 04:43 PM