How to create Objects array or Classes array in C++?
I mean,How to make it so that you do not create objects manually like here:
Prozessor Obj1;
Prozessor Obj2;
I mean, that I don't want to create 10 objects manually.
But by a cycle for or while?
#include <iostream>
using namespace std;
class Prozessor
{
private:
char marka[20];
float chastota;
float cash;
float vartist;
public:
void setProzessor()
{
cout << "Input brand: ";
cin >> marka;
cout << "Input chastotu : ";
cin >> chastota;
cout<<"Input number of cash:";
cin>>cash;
cout<<"Input vartist:";
cin>>vartist;
}
void showProzessor()
{
cout << marka << " " << chastota <<" "<< cash << " " << vartist <<endl;
}
};
int main()
{
Prozessor Obj1;
Prozessor Obj2;
cout<<"vvedit dani"<<endl;
Obj1.setProzessor();
Obj2.setProzessor();
Obj1.showProzessor();
Obj2.showProzessor();
return 0;
}