Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Uniones
- #include <iostream>
- using namespace std;
- union _persona
- {
- char nombre[10], inicial;
- }pers;
- int main()
- {
- cout << "Nombre " << endl;
- cin >> pers.nombre;
- cout << "\nTu nombre es: \n" << pers.nombre << endl;
- cout << "Tu inicial es: \n " << pers.inicial << endl;
- //Cambio de inicial
- pers.inicial = 'Z';
- cout << "\n Ahora tu nombre es:\n " << pers.nombre << endl;
- cout << "Y tu inicial es: \n", pers.inicial;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement