关于#c++#的问题,如何解决?

c++输入一个班10个人的高数成绩,按与输入相反的顺序输出这10个成绩。不使用数组实现和使用数组实现(两种方法)
#include
int main()
{
……
return 0;
}
有没有此类解法,里面的内容最好能用printf、scanf,while、do……while、for解决

不用数组:

#include<stdio.h>
void foo(int n)
{
if (n == 0) return;
int x;
scanf("%d", &x);
foo(n - 1);
printf("%d ", x);
}
int main()
{
foo(10);
return 0;
}

用数组

#include<stdio.h>
int main()
{
int a[10];
for (int i = 0; i < 10; i++) scanf("%d", &a[i]);
for (int i = 0; i < 10; i++) printf("%d ", a[9 - i]);
return 0;
}

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^