|
It is currently Fri Jan 09, 2009 5:17 am
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 2 posts ] |
|
| Author |
Message |
|
Kotik
|
Post subject: Simple C++ Code Posted: Wed Mar 16, 2005 1:06 am |
|
 |
| 1000+ Club |
 |
Joined: Mon Aug 23, 2004 1:25 am Posts: 1082 Location: Sweden
|
|
//Written by Arman Iqbal
#include <iostream.h>
main()
{
int med;
int pass;
int correct1 = 12345; //password for user nr 12
int correct2 = 54321; //password for user nr 24
cout << "Type in your membership number : \n";
cin >> med;
switch (med) {
case 12:
cout << "Type in your password : \n";
cin >> pass;
if (pass == correct1) {
cout << "You have successfully logged into your account \n";
break;
}
else {
cout << "Your password is incorrect. Run the program again. \n";
break;
}
case 24:
cout << "Type in your password \n";
cin >> pass;
if (pass == correct2) {
cout << "You have successfully logged into your account \n";
break;
}
else {
cout << "Your password is incorrect. Run the program again. \n";
}
default:
cout << "The membership number is invalid. Access denied.\n\n";
}
return 0;
}
_________________ DEVPPL : News Publisher
|
|
| Top |
|
 |
|
Vankelmod
|
Post subject: Posted: Mon Nov 13, 2006 6:34 pm |
|
Joined: Sun Nov 05, 2006 3:59 pm Posts: 10
|
|
I feel kind of stupid for asking this question. HadI written this program I would have begun with:
#include<iostream>
using namespace std;
Is there a rigth or wrong way? I thought for sure your code would generate an error message, though my compiler accutally doesn't protest more than a little.
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums. Click here to Register
If you are a current member here on DEVPPL, please login below:
|
|
|