mardi 20 mars 2018

Only the last input loop shows. Instead of showing every input loop (see below)

I am having this issue when I input how many stuff I want to archive, the program prints me only the last input no matter what how many different inputs I made. I made a string called "NombresEst" for names and for emails "EmailEst". I want to print all the different inputs I have made instead of only the last one.

#include <iostream>
#include <fstream>
#include <string>
#include <time.h>
#include <sstream>
using namespace std;
string stff = "1234567890!@#$%^&*()_+=-";
string UniverEmail = "@atlanticu.edu";
int main()
{
srand(time(NULL));

cout << "Examen PARTE I\nCrear un programa para archivar informacion de estudiantes\n\n"; system("pause");
cout << endl << endl;


string NombresEst, Estudiantes;
string NumerosEst;
string  Numeros3 = { "150" };
string EmailEst, EMEstudiantes;




string *pointer = NULL; // NULL es 0
int Veinte, add = 0;
cout << "Cuantos estudiantes quieres archivar?: ";
cin >> Veinte; system("cls");
cin.ignore();
pointer = new string[Veinte];


for (int x = 0; x < Veinte; x++) {


    cout << "Escriba su nombre y apellidos: ";
    getline(cin, NombresEst);
    stringstream(NombresEst) >> Estudiantes;
    *(pointer + x) = NombresEst;

    cout << "Escriba su username para su email. Automaticamente, se agregara @atlanticu.edu: ";
        getline(cin, EmailEst);
        stringstream(EmailEst) >> EMEstudiantes; 
    while (NombresEst.find_first_of(stff) != string::npos)
    {
        cout << "Solo Letras: "; getline(cin, NombresEst);
    }
}


   for (int x = 0; x < Veinte; x++)
   cout << endl << NombresEst << " fue matriculado a Atlantic \nSu email es: " << EmailEst << UniverEmail << endl;














cout << "\n\n";
system("pause");
 }

Aucun commentaire:

Enregistrer un commentaire