Good morning, I have the following exercise in which I wish that at the end of the program I would throw a list with the names and ID of those who are foreigners. How can I do it?
#include <iostream>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
/*3. Desarrolle un programa en C++ que lea el nombre y la nacionalidad
18 pasajeros, e imprima los datos de los pasajeros
con nacionalidad no venezolana. Utilice ciclo For*/
char nom[10], nac;
int ve=0,ex=0, n=0,c;
system("color A");
for (n=1;n<=2;n++)
{
system("cls");
cout<<"Seleccione su Nacionalidad: \n";
cout<<" A: Extranjero\n";
cout<<endl;
cout<<" B: Venezolano\n";
cin>>nac;
cout<<endl;
switch(nac)
{
case 'a': case 'A':
cout<<" "<<n<<") Ingrese su nombre: ";
cin>>nom;
ex++;
cout<<"\nIngrese su Cedula: ";
cin>>c;
break;
case 'b': case 'B' :
cout<<" "<<n<<") Ingrese su nombre: ";
cin>>nom;
ve++;
cout<<"\nIngrese su Cedula: ";
cin>>c;
break;
default:
cout<<" Opcion no valida";
cout<<endl;
n--;
}
}
system("cls");
cout<<"\nNumero de Extranjeros: "<<ex;
cout<<"\nNumero de Venezolanos: "<<ve;
return 0;
}