Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Fri Jan 09, 2009 5:17 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Simple C++ Code
PostPosted: Wed Mar 16, 2005 1:06 am 
Offline
1000+ Club
User avatar

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
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 6:34 pm 
Offline

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
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

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:

User:
Pass:
Log me on automatically each visit: