| View previous topic :: View next topic |
| Author |
Message |
seeplusplus Grandmaster Cheater
Reputation: 0
Joined: 28 Oct 2007 Posts: 562 Location: cracking accounts
|
|
| Back to top |
|
 |
The Dami3n Master Cheater
Reputation: 1
Joined: 15 Nov 2006 Posts: 441 Location: Mulkerolandia
|
Posted: Tue Oct 30, 2007 1:27 pm Post subject: |
|
|
Make program like bank:
1st it will ask pin, the pin is in some random file in same folder.
If its right ask how much would you like to take out (money that is), your money ammount should be in random file too (use Bank.txt or something like that). If you dont have enough money make error message, if you do have program says moneys taken or something and then calculates new value in that bank.txt file... Oh and if you fail the pin to many times make something to happend like, give error message "Pin failed 3 times, card sucked in" and then exit program.
Try that
_________________
|
|
| Back to top |
|
 |
Robotex Master Cheater
Reputation: 0
Joined: 05 Sep 2006 Posts: 378 Location: The pizza country!
|
Posted: Tue Oct 30, 2007 1:32 pm Post subject: |
|
|
you can find many challenges in sites like HTS
_________________
ASM/C++ Coder
Project Speranza lead developer |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Oct 30, 2007 1:52 pm Post subject: |
|
|
Look at the small apps you use all the time and remake it yourself with more features. Start with something small though, don't get yourself in over your head to the point where you want to give up.
_________________
- Retired. |
|
| Back to top |
|
 |
seeplusplus Grandmaster Cheater
Reputation: 0
Joined: 28 Oct 2007 Posts: 562 Location: cracking accounts
|
Posted: Tue Oct 30, 2007 2:43 pm Post subject: |
|
|
Thanks guys I'll try the bank one, just one question, Is there a tutorial on importing / creating outside files, I didn't see much on the tutorials I read.
_________________
I am xwallflowerx...this will probably be deleted soon... |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue Oct 30, 2007 3:03 pm Post subject: |
|
|
search for reading a file and writing a file.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Oct 30, 2007 4:45 pm Post subject: |
|
|
| seeplusplus wrote: | | Thanks guys I'll try the bank one, just one question, Is there a tutorial on importing / creating outside files, I didn't see much on the tutorials I read. |
Theres several different methods, and different types of files you can use for something like this. Such as:
- INI file
- XML file
- Coma-Seperated file
- Flat Database file
- SQL / or other simular database.
For a bank, I'd assume they would be using an SQL database with some custom modifications to ensure security, stability, and such.
Heres some examples:
INI File:
http://www.codeproject.com/cpp/CIni.asp
XML File:
http://www.grinninglizard.com/tinyxml/index.html
Basic file formats can be done via file input/output routines in iostream:
http://msdn2.microsoft.com/en-us/library/22z6066f(VS.80).aspx
_________________
- Retired. |
|
| Back to top |
|
 |
seeplusplus Grandmaster Cheater
Reputation: 0
Joined: 28 Oct 2007 Posts: 562 Location: cracking accounts
|
Posted: Tue Oct 30, 2007 7:05 pm Post subject: |
|
|
#include <iostream>
#include <fstream>
using namespace std;
int checkPin(int pin,bool correct);
int main()
{
int pin=0000;
int choice=0;
bool correct=false;
cout<<"Bank Program";
cout<<"\n Please enter your pin number";
cin>>pin;
checkPin(int pin, bool correct);
cin.get();
return 0;
}
int checkPin(int pin,bool correct)
{
int tries=0;
while(tries<4){
if(pin!=1234)
{
cout<<"\nIncorrect pin please enter the correct pin.";
tries++;
}
if(pin==1234)
{
correct=true;
}
}
if(tries==4)
{
cout<<"\nCard eaten, have a nice day.";
tries=0;
}
}
int withdraw(int choice)
{
}
This is what I have so far, im just a little lost on the whole I/O thing i even tried looking it up many times, but most of the tutorials make no sense...
_________________
I am xwallflowerx...this will probably be deleted soon... |
|
| Back to top |
|
 |
The Dami3n Master Cheater
Reputation: 1
Joined: 15 Nov 2006 Posts: 441 Location: Mulkerolandia
|
Posted: Wed Oct 31, 2007 12:34 am Post subject: |
|
|
so my idea was good
_________________
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Wed Oct 31, 2007 1:43 pm Post subject: |
|
|
For what he's doing you don't need anything except a simple text file and fopen/fread/fwrite.
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Wed Oct 31, 2007 1:58 pm Post subject: |
|
|
change your if in CheckPin to <= 4 or else you will never get the card tries to = 4.
_________________
|
|
| Back to top |
|
 |
seeplusplus Grandmaster Cheater
Reputation: 0
Joined: 28 Oct 2007 Posts: 562 Location: cracking accounts
|
Posted: Wed Oct 31, 2007 10:22 pm Post subject: |
|
|
| blankrider wrote: | | change your if in CheckPin to <= 4 or else you will never get the card tries to = 4. |
yeah but pin tries starts at one
0-default
1-first
2-second
3-third.
after it hits three the while loop ends.
_________________
I am xwallflowerx...this will probably be deleted soon... |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Thu Nov 01, 2007 3:07 am Post subject: |
|
|
- bool correct will be always false, because you're not messing with pointers. -> Use pointers.
- What if user inputs a string, not numbers? -> Make a check.
- If you want to pause your program like that, the proper way instread of std::cin.get(); is | Code: | std::cin.ignore();
std::cin.sync(); |
- You're abusing a nice feature of C++, the namespaces.
- For optimization, if pin isn't 1234, it must be something else, so revise if, elseif and else.
- What's this "int withdraw(int choice)"? O_o It isn't prototyped...
PS. [ code ]'ing your code is a nice way to make it more readable.
|
|
| Back to top |
|
 |
|