Disclaimer: I have not worked with Turbo C++ before, but from what I gather it is essentially C with a subset of C++ features.
I'm not sure if you got @rockStar's version to work so I will post a slightly cleaner and working version on your main
.
int main(){
clrscr();
char name[5][80] ={ "Lester", "Charmander", "Squirtle", "Bulbasaur","Pikachu"};
int numbers[10]; //'temporary array' to store the list of numbers
int n;
int num = 0;
for(n=0; n<=10 && num != 5; n++){
cout <<"Enter your student number: ";
cin >> num;
if(num > 0 && num < 6){
cout << name[num-1] << '\n';
numbers[n] = num;
}
}
clrscr();
int i;
for(i=0; i<n; i++){ //there were n entries
cout << name[numbers[i] -1]<<"\n";
}
return 0;
}
It produces the output you requested (minus the indentation of everything past the first line).