daily pastebin goal
39%
SHARE
TWEET

Не уходи постой, Рогозин

a guest Nov 5th, 2018 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <string>
  2. #include <iostream>
  3. #include <stdexcept>
  4. #define N 5
  5. using namespace std;
  6.  
  7. struct user
  8. {
  9.     int userID;
  10.     string userName;
  11.     int password;
  12.     string testPassword;
  13. };
  14.    
  15. int main()
  16. {
  17.  
  18.     int c;
  19.     user userList[N]={};
  20.    
  21.     for (int i = 0; i<N; ++i)
  22.     {
  23.         cout<<"Enter user ID: ";
  24.         cin>>userList[i].userID;
  25.         cout<<"Enter username: ";
  26.         cin>>userList[i].userName;
  27.         cout<<"Enter user password: ";
  28.         cin>>userList[i].password;
  29.     }
  30.     for (int i = 0; i < N; ++i)
  31.     {
  32.         c = userList[i].password;
  33.         while (c > 9)
  34.         {
  35.             c = c / 10;
  36.         }
  37.         if ((c == 1) && ((userList[i].password % 10) == 0))
  38.         {  
  39.             cout<<"Correct userdata: ";
  40.             cout << userList[i].userID <<" ";
  41.             cout << userList[i].userName <<" ";
  42.             cout << userList[i].password <<" \n";
  43.         }
  44.         else
  45.         {
  46.             cout<<"User #"<<i + 1<<" has incorrect password"<<"\n";
  47.         }
  48.     }
  49.     return 0;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top