Thread: little help

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    34

    little help

    ok working on a little toy for me i need to no how i can putt someting in to a c++ program so that i can add info to the program
    whitout haveing to open the source code and type it in
    <edited for spelling>


    Code:
     
     #include <iostream>
     #include <cstdlib>
     
     using namespace std;
     int main()
     { 
            int factor; // factor for geting password must be enterd to get the password's
     factor = 111111;
           int Keyboardinput; 
      int yes;       // int for seeing if you would like to get password or  not
         yes = 1;
      int no;
         no = 2;
      int password;
      
          cout<<"would you like to see a password or add a password";
           
              cout<<"                               see password 1: ";
      
        cout<<"                                                                 enter password 2: ";
        
               cin>> password;
               
       if ( yes == password ) 
       cout<<"enter a password: ";
     
           cin>> Keyboardinput;
     
       if ( factor == Keyboardinput )
    -----------------------------------------------------------------------
         cout<<"password list 789678,hellomom"<<endl;
    -----------------------------------------------------------------------
             else
             if ( no == password )
    -----------------------------------------------------------------------
                  cout<<" please enter a password you would like to add: ";
    ----------------------------------------------------------------------- 
    ok right here i need a way so that it will add someting to show  more passwords in the box market  up top...
       system("PAUSE");   
       return 0;   
     }

    any 1 can help me i ould love the help
    what ya thank how is my first program comeing along?
    Last edited by eric123; 03-30-2006 at 11:09 AM.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    i can putt soemting in to a c++ program so that whine i get to the point whear
    I suggest you put programming aside and concentrate on more important things--like reading and writing.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    34
    I Didn't Ask For What You Have To Say On My Spelling If You Don't Have Someting Good To Say You Need To Shut Up

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    I don't think he meant it to be nasty...it was just a bt of sarcasm.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    34
    still this website is for learning and help and thats y i am here. not to here this dud be an ass

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If nobody can understand what you write (or everybody understands, but not what you actually meant to say), then nobody can help you... aside from advising you to get your basic literacy up to scratch so that you can communicate more effectively.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    I'm really not following what you want to do. If you have a variable with a value, it already is saved so you can output it later -- just output the variable.

    And some people just don't quite understand that people that don't speak English as their native language aren't experts at English syntax and spelling. Ignore them...
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  8. #8
    Registered User
    Join Date
    Nov 2005
    Posts
    34
    ok the point of this program was to hold passwords for all my onlines games i play so that people that use my pc can't get to them

    as of right now the only way i no of to add soemting like
    cout<<"password list 789678,hellomom";
    would be to type it in to the source file
    im looking for a way to add someting to it like this

    cout<<"password list 789678,hellomom";
    <<"password list 234566,hellomom";
    cometing like that but whitout me haveing to type it in and then complie

    so whear it says
    cout<<" please enter a password you would like to add: ";

    i would type in the 2 passwords and it would save it
    and add it to the source code so that it will be added next time i look them up

  9. #9
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You could read the passwords, encrypt them, and then write to file. To retrieve them, you read the ciphertext, decrypt and then print.

    If you are looking for a quick fix, you could consider just using say Password Safe.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  10. #10
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    look into file i/o and filestreams (specifically fstream). That should get you started on what you need. But after that, if you dont want anybody else to get to it you will need to have the file you store all the passwords to encrypted by some algorithm.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  11. #11
    Registered User
    Join Date
    Nov 2005
    Posts
    34
    a frinde told me about this thange called a rot 13 cyper i was going to tri to work that into it in some way but if i can't the people that use my pc have no ideal how to use any of thes stuff so as long as the pass words are stored in a file that they can't get into or can't read it will work =)

  12. #12
    Registered User
    Join Date
    Nov 2005
    Posts
    34
    Quote Originally Posted by laserlight
    You could read the passwords, encrypt them, and then write to file. To retrieve them, you read the ciphertext, decrypt and then print.

    If you are looking for a quick fix, you could consider just using say Password Safe.

    thanks any way but if its not soemting i can make and learn from thin i don't whant to use it sorry=(


    file i/o is all the way at the back of my programming book =) ging to jump to it to look up what i need to no
    ty=)

    well this looks hard lol
    Last edited by eric123; 03-30-2006 at 12:19 PM.

  13. #13
    C/C++ homeyg's Avatar
    Join Date
    Nov 2004
    Location
    Louisiana, USA
    Posts
    209
    Repeat after me:

    a b c d e f g h i j k l m n o p q r s t u v w x y z

    Now try to say this:

    c a t

    BTW, what you are trying to do (by what you said) and what your source code shows has nothing to do with each other.

    You say that you want to be able to add code to the source file but then you post some password program.

    Code:
    // factor for geting password must be enterd to get the password's
    For Christ's sake! What the hell does that mean?? It looks like you need to learn English and then TRY to learn to program.
    Last edited by homeyg; 03-31-2006 at 09:13 AM.

Popular pages Recent additions subscribe to a feed