做习题的时候遇到个有关问题

做习题的时候遇到个问题
#include <iostream>
#include <string>
using namespace std;
struct car
{
string scs;
int nian;
};
int main()
{
cout << "How many cars do you wish to catalog? ";
int i;
cin >> i;
cin.get();
car* sh = new car[i];
for (int n = 1; n <= i; n++)
{
cout << "Car #" << n << ":\n";
cout << "Please enter the make: ";
getline(cin, sh[n - 1].scs);
cout << "Please enter the year made: ";
cin >> sh[n - 1].nian;
cin.get();
}
cout << "Here is your collection: \n";
for (int x = 1; x <=i; x++)
    cout << sh[x-1].nian <<" "<<sh[x-1].scs << endl;
delete sh;
return 0;
}

这个东西,运行到最后,输出和题目要求已经一样了,但是突然出现个错误提示,点了半天,上传不起错误提示的图片-_-我看了好几遍,没有发现中间有什么没对的地方啊,请大神们帮帮忙找下原因,谢谢啦!

------解决方案--------------------
cin.get()有点问题,貌似读不到正确的数据,如果你在输入nian的时候后面加空格之类的话
------解决方案--------------------
引用:
  delete [] sh;

做习题的时候遇到个有关问题
小程序是不会出现 没有回收资源 导致出现的问题把?
  大程序也会呗系统机制 进行自动回收~!做习题的时候遇到个有关问题