C + + experiment 5

Source: Internet
Author: User

I. Questions and codes

/  * File name: C + + experiment 5*    : Liu Yin * completion date: May 10, 2016  * Version number: v1.0  * Description of the task and solution method part: Separating odd and even numbers using an array * Enter a description: Enter any 10 number * Problem Description: My fifth C + + program, familiar with the meaning of the array and the use of * program output: Separate odd and even * problem analysis: Correctly save the number to a different array * algorithm design: Slightly *  /#include <iostream.h>void main () { int A[10],b[10],c[10],i,j=0,k=0;for (i=0;i<10;i++) {cin>>a[i];if (a[i]%2==0) {b[j]=a[i];j++;} else {c[k]=a[i];k++;}} cout<<endl;cout<< "even is:"; for (i=0;i<j;i++) {cout<<b[i]<< "";} cout<<endl;cout<< "Odd is:"; for (i=0;i<k;i++) {cout<<c[i]<< "";} Cout<<endl;}
ii. Results of Operation

Third, experience

C + + in the use of arrays and understanding will be more abstract, especially with the front of the circular statement, many places will appear some difficult to solve problems, but through continuous learning and practice, finally better grasp the use of the array, but also finally succeeded in solving this problem, good practice will always succeed.

Iv. Summary of Knowledge points

There are many things to be particularly important in the array, such as the size of the array, the number of arrays, subscript, input, output, initialization, and so on, as long as the master of these basic points, I believe that the use of arrays is not too big, refueling!

C + + experiment 5

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.