Guest User

Untitled

a guest
Feb 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include<iostream.h>
  2. #include<iomanip.h>
  3. #include<stdlib.h>
  4. struct car{
  5. char bname[50];
  6. int years;
  7. };
  8. int main()
  9. {
  10. int size;
  11. cin>>size;
  12. car *pc=new car[size];
  13. for(int i=0;i<size;i++)
  14. {
  15. cout<<"\nCar #"<<i+1<<":\n";
  16. cout<<"please enter the make:";
  17. cin>>(pc+i)->bname;
  18. cout<<"please enter the year made:";
  19. cin>>(pc+i)->years;
  20. }
  21. for(i=0;i<size;i++)
  22. {
  23. cout<<(pc+i)->years<<" ";
  24. cout<<(pc+i)->bname<<"\n";
  25. }
  26.  
  27. delete [] pc;
  28. return 0;
  29. }
Add Comment
Please, Sign In to add comment