C ++ primer Chinese Version 4th exercise 4.28

Source: Internet
Author: User

/* Here I will write down some of my answers and comments for the exercises in C ++ primer 4th (Note: I didn't buy an answer book, so it is not guaranteed that it is correct. What do you think is wrong, hope you can tell me)Source codeThe running requirements are the same as those in the book. The pre-compilation and using lines are omitted. If you still don't know what to say, you can ask me, but I am also a beginner and may not know, I know that I am a beginner when I am still studying C ++ Prime. You are welcome to repost it, but please keep the author's name "jiutian Yuling "*/

 

Int main ()
{
Vector <int> IVC;
Int IA;
While (CIN> IA)
IVC. push_back (IA); // creates an int-type vector object.
Int * PIV = new int [IVC. Size ()]; // dynamically create an int array with the size equal to the IVC size
For (INT n = 0; n! = IVC. Size (); N ++)
PIV [N] = IVC [N];
Cout <Endl;
For (INT n = 0; n! = IVC. Size (); N ++)
Cout <* (PIV + n) <"";
Return 0;
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.