- Enter 10 integers and then reverse-order the output by one (most direct)
- #include "stdafx.h"
- #include <iostream>
- using namespace Std;
- void Main () {
- int A1, a2, A3, A4, A5, A6, A7, A8, A9, A10;
- cout << "Input ten integers:\n";
- CIN >> A1 >> A2 >> A3 >> A4 >> a5 >> a6 >> A7 >> A8 >> A9 >> A 10;
- cout << "------------result-------------" << Endl;
- cout << A10 << "<< A9 <<" << A8 << "<< A7 <<" "<< A6 < < "";
- Cout << a5 << "<< A4 <<" << a3<< "" << A2 << "" << A1 <&L T "<< Endl;
- }
- Enter 10 integers and then reverse-order the output by two (array type)
- #include "stdafx.h"
- #include <iostream>
- using namespace Std;
- void Main () {
- int a[10], i = 0;
- cout << "Enter itegers:" << Endl;
- for (i = 0; i <; i++)
- CIN >> A[i];
- cout << "-------result--------" << Endl;
- for (i = 9; I >= 0; i--)
- cout << a[i]<< "";
- }
Two implementations of string-----input 10 integers and then reverse output