Thread: help with C++
View Single Post
  #1  
Old 06-24-2004, 07:59 PM
x-scythe
Discordant
 
Join Date: Jun 2003
Posts: 449
Default help with C++

been here like a year now and decided i want to learn C++ so i can help out more.
ive been practicing a few things since some of it seems to be the same as PERL. i ran into an error tho...
what i want this simple program to do is ask people to type in a username and then i want it to ask them for a password. people who put the wrong pass in get this message "Incorrect Pass. Good-Bye." and people who put the right one get this message "You have accessed my information. You are lame!" For some reason tho, every time you put in your username you get the message you would get for a correct password instead of the "Enter Password" prompt.
heres is the code
Code:
//basic pass

#include <iostream.h>
#include <stdio.h>

int main()
{
	//enter username
	int name;
	cout << "Enter Username:";
	cin >> name;

	//enter pass
	int pass;
	pass = 5;
	cout << "Enter Password:";
	cin >> pass;

	if(pass != 5)
	{
		cout << "Incorrect Password. Good-bye.";
	}
	if(pass == 5)
	{
		cout << "You have accessed my information! You are lame!";
	}

	return;
}
thats it...any help would be appreciated greatly.

also if anyone could respond with what exactly the beginning "int main()" function does would also be appreciated hehe...i have no clue what its for. i know it has something to do with declarations maybe?
Reply With Quote