View Single Post
Old Aug 10th, 2006, 9:36 AM   #7
RemoteC2
Programmer
 
RemoteC2's Avatar
 
Join Date: Jan 2006
Posts: 55
Rep Power: 3 RemoteC2 is on a distinguished road
the reason that i didnt initialize ps and usr, is b/c the program makes it so that the user inputs the password. i made this program just to see if i could..anways, thx everyone for the help. the program works now, and the final source is this:

//store/check password
#include <iostream>
#include <cstdlib>
using namespace std;

class pswrd {
public:
      char ps[80], usr[80];
      int len;
      void set_ps (char *p) {strcpy(ps, p);}
      void check_ps () {
            printf("\nPassword: ");
            cin>>usr;
            if(strcmp(usr,ps)) cout<<endl<<"Access Denied";
            else if cout<<endl<<"Access Granted";
       }
};

int main ()
{
    pswrd ob1;
    char p[80];
    printf("Set Password: ");
    cin>>p;
    ob1.set_ps(p);
    ob1.check_ps();
    system("PAUSE");
}
RemoteC2 is offline   Reply With Quote