0
How can i use c++ to accept 10 figures of 3digit in a chronological order and print out the result in a reverse order
13 Antworten
+ 1
int or float?
+ 1
Yes, and I want to help you. I need to know if the figures are integral or if they have a floating point.
+ 1
#include <iostream>
#include <array>
#include <algorithm>
int main()
{
std::array<int, 10> nums;
for (int& elem : nums)
std::cin >> elem;
std::reverse(nums.begin(), nums.end());
for (const int elem : nums)
std::cout << elem << ' ';
}
+ 1
thanks to you
+ 1
No problem.
+ 1
Show me the compiler errors.
0
I want how the program will be
0
because am still a learner
0
the figure is in integer
0
what I mean is that if the integers are 100, 200, 300, 400, 500 then the output should be in the reverse order i.e 500, 400, 300, 200, 100.
0
does the code run
0
really appreciate it
0
this program failed to run on my system. wat may likely cause the problem. pls I need an explanation