48. Input any positive integer and program to determine whether the number is the number of replies (the number of replies is the same as the number of reads from left to right, such as 12321)

Source: Internet
Author: User
// 1. Input a number to separate each digit, and save it as an array // 2. Determine the first bit of the array that is input at the end. // 3. Determine whether the number of returned questions is satisfied cyclically. # include <iostream> using namespace STD; int main () {int N, temp; int K = 0; int A [20]; cout <"Please input an number:" <Endl; CIN> N; for (INT I = 0; I <20; I ++) // used to separate each bit and store it in the array {If (n> = 1) {temp = n % 10; // key steps for separation a [I] = temp; n = N/10; k ++; // counter, can you know how many digits this number has?} For (INT m = 0; m <K; m ++) // you can determine whether this number is a return number {if (a [m]! = A [k-m-1]) {cout <"this is not the number of replies! "<Endl; break; // skip loop} else {cout <" this is the number of replies! "<Endl; break; // skip loop} return 0 ;}

 

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.