Advertisement
Diegols

cad_user.cpp

Apr 11th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. class Conta{
  7. private:
  8.     char name[20], username[20], password[20];
  9.     int idade;
  10.  
  11. public:
  12.     Conta(){}
  13.  
  14.     void setIdade(){
  15.         this->idade = idade;
  16.     }
  17.     int getIdade(){
  18.         return this->idade;
  19.     }
  20.  
  21.     void setPassword(char* password){
  22.         strcpy(this->password, password);
  23.     }
  24.     char* getPassword(){
  25.         return password;
  26.     }
  27.  
  28.     void setUsername(char* username){
  29.         strcpy(this->username, username);
  30.     }
  31.     char* getUsername(){
  32.         return username;
  33.     }
  34.  
  35.     void setNome(char* name){
  36.         strcpy(this->name, name);
  37.     }
  38.     char* getNome(){
  39.         return name;
  40.     }
  41.  
  42. };
  43.  
  44. void gs_username(Conta conta){
  45.     char user[20];
  46.     cout << "Username: "; cin >> user;
  47.     conta.setUsername(user);
  48. }
  49.  
  50. void gs_password(Conta conta){
  51.     char pass[20];
  52.     cout << "Password: "; cin >> pass;
  53.     conta.setPassword(pass);
  54. }
  55.  
  56. int main(){
  57.  
  58.     Conta a;
  59.     gs_username(a);
  60.     gs_password(a);
  61.  
  62.     cout << "\nUsername = " << user << endl;
  63.     cout << "Password = " << pass << endl;
  64.     return 0;
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement