>it tends to make them look a little bit lame
"leet speak" is entertaining when used sparingly and in a tasteful manner. Unfortunately, most people don't know where the line is and cross it on a regular basis.
>Can you use an "If" statement within another "If" statement?
Yes, you can nest any of the control structures as much as you want. Technically there are limits, but the standard specifies limits that you would be insane to approach (something like 127 levels) and implementations usually allow for much more.
>Is there any reason for this?
Yes, actually. Your call to cin's >> operator expects a valid integer. If you type characters that fail to meet that expectation, cin enters a failure state and the contents of the variable remain unchanged. In this case, the value is unpredictable because you don't initialize it to anything. So the program reacts strangely because you're working with unpredictable values.
The nice thing about the >> operator is it knows what type of variable you're giving it, and it expects input that can be represented by that type. That's also a problem if, as you've experienced, the user of the program gives it the wrong input. If you want to accept any kind of input (because the stream works with characters and any type conversions are made by >>), you would be better off using a string variable and getline:
Code:
#include <iostream>
#include <string>
std::string name;
std::string pass;
std::cout<<"User ID: ";
std::getline ( std::cin, name );
std::cout<<"Password: ";
std::getline ( std::cin, pass );
>it always returns the value 0.
This is a sticky area, which is why I suggested you use string objects instead of arrays. The problem is that (and if you don't understand this, just keep it on the backburner for later) most of the time, when an array name is used in an expression, it's converted to a pointer to the first element. So your comparison is actually comparing the value of two pointers, which is comparing two addresses. Since the pointers don't point to the same location in memory, the test fails.
The string class overloads the == operator, so it does what you would expect:
Code:
#include <iostream>
#include <string>
int main()
{
std::string name;
std::string pass;
const std::string valid_name = "jwalker";
const std::string valid_pass = "meep";
std::cout<<"User ID: ";
std::getline ( std::cin, name );
std::cout<<"Password: ";
std::getline ( std::cin, pass );
if ( name == valid_name && pass == valid_pass )
std::cout<<"Hello, "<< name <<"!\n";
else
std::cout<<"Invalid login\n";
}