1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Class Project

Discussion in 'C++' started by aaholland, Sep 12, 2006.

  1. aaholland

    aaholland New Member

    Joined:
    Sep 12, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am writing a program for my college class It has to record a password, but it cant display it on the screen. It is a unix based enviroment. Does this look correct to you guys?


    Code:
     main()
    {
      int  i;
      char buffer[80];            
      initscr();                
    
      printw("Please enter a password => ");    
      refresh();                
      noecho();                
                        
      while((buffer[i] = getch()) != '\n') i++;
    
      printw("\nPassword is %s - press return to continue.",buffer);
      refresh();
      getch();
    
      endwin();                 }
     

Share This Page