Hello , I am learning c++ and I am learning pointer atm.. I would like to make a dynamic array that contain password of each students in class ( for example ) But instead of doing it with const , I would like to know how to do it with pointer ? I want to ask how much students will be in this class , then ask the password for each students , please help me !
Here an example of what I want it to look like :
Keep in mind I didnt learn class yet show me a simple way to do it
Code:
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
int students = 0;
cout << "How much students are you in your class ?" << endl;
cin >> students;
string _students[students];
for (int i = 0; i != students; i++)
{
cout << "Students : " << i << endl;
cin >> _students[i];
}
for (int i = 0; i != students; i++)
{
cout << "Students passwords : \n" << endl;
cout << i << " " << endl;
cout << _students[i];
}
return 0;
}