Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<iomanip.h>
- #include<stdlib.h>
- struct car{
- char bname[50];
- int years;
- };
- int main()
- {
- int size;
- cin>>size;
- car *pc=new car[size];
- for(int i=0;i<size;i++)
- {
- cout<<"\nCar #"<<i+1<<":\n";
- cout<<"please enter the make:";
- cin>>(pc+i)->bname;
- cout<<"please enter the year made:";
- cin>>(pc+i)->years;
- }
- for(i=0;i<size;i++)
- {
- cout<<(pc+i)->years<<" ";
- cout<<(pc+i)->bname<<"\n";
- }
- delete [] pc;
- return 0;
- }
Add Comment
Please, Sign In to add comment