16 Weeks (Project four dynamic array)

Source: Internet
Author: User

/*
*copyright (c) 2014, College of Computer Science, Yantai University
*all rights reserved.
* File Name: 16 weeks (Project four dynamic array)

* Wangzhong
* Completion Date: 2014.12.15

* Version Number: v1.0
*
* Problem Description: Add a dynamic array of the appropriate length, "copy" the data from the original array to the new array, and then enter the new data. An array of new data is added as a new array to hold the data.

* Input Description: Enter score, number of students

* Program output: Number of new student scores

#include <iostream>using namespace Std;int main () {    int num,i,addnum;  Num is the group number    cout<< "Enter the number of students:";    cin>>num;    int *score = new Int[num];    cout<< "Please enter student grade:";    Enter num name Student's score for    (i=0; i<num; i++)        cin>>score[i];//* (score+i)    cout<< "How many students do I need to add?" ";    cin>>addnum;   Addnum is required to increase the number of people    //below the program to complete the expansion of the array and enter additional scores for        (I=num; i<num+addnum; i++)            cin>>score[i];        Num=num+addnum;    cout<< "now has a total of << num <<" Students, their grades are: "<<endl;    for (i=0; i<num; i++)        cout<<score[i]<< "  ";    cout<<endl;    delete []score;    return 0;}


16 Weeks (Project four dynamic array)

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.