What is wrong with my C++ code? (Test login) 11-23-2011, 04:43 PM
#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,
-N1v3k
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

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)