#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
struct car
{
string make;
int year;
};
void main()
{
int noOfCar;
cout<<"Enter the no. of car to cataloge: ";
cin>>noOfCar;
car * detail = new car[noOfCar];
for(int i=0; i<noOfCar;i++)
{
cout<<"\ncar #"<<i++;
cout<<"\nEnter the make: ";
cin.ignore();
getline(cin, detail.make);
cout<<"\nEnter the year made: ";
cin.ignore();
(cin>>detail[i].year).get();
}
//output
for(int i =0;i<noOfCar;i++)
{
cout<<detail[i].year<<" "<<detail[i].make<<endl;
}
delete[] detail;
_getch();
}
im getting problem with a error,
[i]Unhandled exception at 0x011A54D6 in u5ex6.exe: 0xC0000005: Access violation writing location 0xABABABAB.and for loop