>Sorry, that's the best I can do as a newbie programmer.
No biggie, just don't take the following review the wrong way.
>float a_a, b_b;
It's best to choose names that are meaningful to other people and yourself in the future. It saves you all kinds of heartache later on. Also, for multiple reasons but mostly because double is the default floating-point type, you should always use double unless you have a compelling reason not to.
>b_b = 123
Don't forget the trailing semicolon.
>if ( a_a == b_b ) {
I highly recommend not using floating-point data types until you know how to use them correctly. This isn't a flame or anything, it's just that floating-point is incredibly subtle and difficult to work with for just about everyone. If you aren't familiar with the pitfalls then you'll have weird problems that you won't know how to deal with.
In this case, comparing floating-point values for equality is inaccurate because the binary representation of floating-point is inherently imprecise. If you have a_a=1.1 and b_b=1.1 then they still might not be equal if a_a is 1.100001 and b_b is 1.100000 internally.
The solution is to do a "close enough" test that would be dreadfully confusing at this point in your studies, which brings me back to the initial recommendation.
>else if ( a_a != b_b ) {
else nothing is equivalent to else a_a != b_b.
>cin.get();
Good idea, but because you do this for every path taken, you can place it outside of the if statement.
Ignoring the floating-point issues, here's your updated code:
Code:#include <iostream> using namespace std; int main() { double pass, input; pass = 123.0; cout<<"Please enter your password: "; cin>> input; cin.ignore(); if (input == pass) cout<<"Correct!"<<endl; else cout<<"Incorrect"<<endl; cin.get(); }