C + + experiment five-array separation

Source: Internet
Author: User

One, problem and code

/  * file name: 123.cpp  *    Creator: Liu Zhishan * Completion date: 2016  May  9th  * Version number: v1.0 * Description of the  task and Solution Method Section: * Input Description:   * Problem Description: No  * program output: Array b array C   * Problem analysis: slightly  * Algorithm design: Slightly */  #include <iostream>using namespace Std;int Main () {int a[10],b[10],c[10],i,j=0,k=0;cout<< "Please enter 10 number:"; for (i=0;i<10;i++) cin>>a[i];for (i=0;i< 10;i++) {if (a[i]%2!=0) {b[j]=a[i];j++;}        else{c[k]=a[i];k++;}}    cout<< "Array B is:", for (i=0;i<j;i++) cout<<b[i]<< "";cout<<endl;cout<< "Array C is:"; for (i=0 ; i<k;i++) cout<<c[i]<< ""; Cout<<endl;return 0;}

Second, the results of the operation


Third, experience

This is an array of program editing, because there is no thorough knowledge of the array, so written very slowly, after class must grasp the array, do not leave regrets.


Iv. Summary of Knowledge points

Serious reading, combined with examples, to master the editor of the array, there are errors carefully found, slowly corrected.


C + + experiment five-array separation

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.