Two implementations of string-----input 10 integers and then reverse output

Source: Internet
Author: User

  1. Enter 10 integers and then reverse-order the output by one (most direct)
  2. #include "stdafx.h"
  3. #include <iostream>
  4. using namespace Std;
  5. void Main () {
  6. int A1, a2, A3, A4, A5, A6, A7, A8, A9, A10;
  7. cout << "Input ten integers:\n";
  8. CIN >> A1 >> A2 >> A3 >> A4 >> a5 >> a6 >> A7 >> A8 >> A9 >> A 10;
  9. cout << "------------result-------------" << Endl;
  10. cout << A10 << "<< A9 <<" << A8 << "<< A7 <<" "<< A6 < < "";
  11. Cout << a5 << "<< A4 <<" << a3<< "" << A2 << "" << A1 <&L T "<< Endl;
  12. }
  13. Enter 10 integers and then reverse-order the output by two (array type)
  14. #include "stdafx.h"
  15. #include <iostream>
  16. using namespace Std;
  17. void Main () {
  18. int a[10], i = 0;
  19. cout << "Enter itegers:" << Endl;
  20. for (i = 0; i <; i++)
  21. CIN >> A[i];
  22. cout << "-------result--------" << Endl;
  23. for (i = 9; I >= 0; i--)
  24. cout << a[i]<< "";
  25. }

Two implementations of string-----input 10 integers and then reverse output

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.