Столкнулся с проблемой в коде:
1)error C2057: требуется константное выражение
2)error C2466: невозможно выделить память для массива постоянного нулевого размера 3)error C2133: List: неизвестный размер
Сам код программы:
#include "stdafx.h"
#include "iostream"
#include "stdio.h"
#include "locale"
using namespace std;
struct CPU
{
string Name;
float Hz;
int RAM;
int SRAM;
int Price;};
int main()
{
int count;
cin>>count;
CPU List[count];
for (int i=0;i<count;i++) {
cout<<"Name ";cin>>List[i].Name;
cout<<"HZ ";cin>>List[i].Hz;
cout<<"RAM ";cin>>List[i].RAM;
cout<<"SRAM ";cin>>List[i].SRAM;
cout<<"Price ";cin>>List[i].Price;
}
system("pause");
}
В чем причина?