This pointer is destroyed at the end of this function
Also you never call it again anyway so the the whole function is redundant.
1 2 3 4
|
void StorePin(){
cin >> pin;
int *pinPointer = &pin;
}
|
I dont think you quite understand how to use pointers and references yet.
So maybe look over them again
Also why do you have semicolons at the end of half your functions ?
And is there really a need for all the functions ?
I honestly dont even know what you are trying to do in half of them.
There's not really any need for pointers at all, unless of course youre just using them to learn, as you have used global variables so they are visible to all functions
Anyway
I made this really quick to give you an idea of how i would do it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
#include <iostream>
using namespace std;
void CreatePin();
void StorePin();
void ChangePin();
void OverWritePin();
void AlterPin();
int pin;
int newPin;
int main()
{
CreatePin();
ChangePin();
}
void CreatePin()
{
cout << "Input new pin: " ;
cin >> pin;
}
void ChangePin()
{
cout << "Input old pin to pass security stage:";
int x = 0;
cin >> x;
if(x==pin)
OverWritePin();
else
cout << "Pin incorrect";
}
void OverWritePin()
{
}
void AlterPin()
{
}
|
Obviously ive left some for you to do :)
Hope it helps.