16 weeks (item 4 Dynamic Array), 16 weeks project Dynamic Array

Source: Internet
Author: User

16 weeks (item 4 Dynamic Array), 16 weeks project Dynamic Array

* Copyright (c) 2014, computer College, Yantai University
* All rights reserved.
* File name: 16 weeks (Project 4 Dynamic Array)

* Author: Wang Zhong
* Completion date: 2014.12.15

* Version: v1.0
* Problem description: Add a dynamic array with an appropriate length, copy the data in the original array to the new array, and then enter the new data. The array after adding new data becomes the new array for saving data.

* Description: score, number of students

* Program output: Number of new students


# Include <iostream> using namespace std; int main () {int num, I, addNum; // num is the number of students in the group cout <"Number of Students input :"; cin> num; int * score = new int [num]; cout <"Enter the Student score:"; // enter the score of the student with the num name for (I = 0; I <num; I ++) cin> score [I]; // * (score + I) cout <"how many students need to be added? "; Cin> addNum; // addNum is the number of people to be added. // The following program completes the expansion of the array, and enter another score for (I = num; I <num + addNum; I ++) cin> score [I]; num = num + addNum; cout <"Total" <num <"Name, their scores are: "<endl; for (I = 0; I <num; I ++) cout <score [I] <""; cout <endl; delete [] score; 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.