⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 守望天使飞过.cpp

📁 我学习C++ Primer Plus过程中写下的课后作业的编程代码
💻 CPP
字号:
#include "iostream"
#include "string"
using namespace std;
struct car
{
	string sProducter;
	int iProYear;
};
int main()
{
	int size;
	cout<<"How many cars do you wish to catalog?";
	cin>>size;
	cin.get();
	car *pCar=new car[size];
	for (int i=0;i<size;i++)
	{
		cout<<"Car #"<<i+1<<endl;
		cout<<"Please enter the make:";
		//cin.get(pCar[i].sProducter,20);
		//cin.get();
		getline(cin,pCar[i].sProducter);
		//cin.get();
		cout<<"Please enter the year made:";
		cin>>pCar[i].iProYear;
		cin.get();
	}
	cout<<"Here is your collection:"<<endl;
	for (i=0;i<size;i++)
	{
		cout<<pCar[i].iProYear<<" "<<pCar[i].sProducter<<endl;
	}
	delete []pCar;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -