Advertisement
plantbae

Uniones

Feb 16th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. // Uniones
  2. #include <iostream>
  3. using namespace std;
  4. union _persona
  5. {
  6.     char nombre[10], inicial;
  7. }pers;
  8.  
  9. int main()
  10. {
  11.     cout << "Nombre " << endl;
  12.     cin >> pers.nombre;
  13.     cout << "\nTu nombre es: \n" << pers.nombre << endl;
  14.     cout << "Tu inicial es: \n " << pers.inicial << endl;
  15.     //Cambio de inicial
  16.     pers.inicial = 'Z';
  17.     cout << "\n Ahora tu nombre es:\n " << pers.nombre << endl;
  18.     cout << "Y tu inicial es: \n", pers.inicial;
  19.     system("pause");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement