luogu P1427小鱼的数字游戏

小鱼的数字游戏

本来想用字符串做,但是后来发现并不用啊!,只要正这读入,反向输出就可以啦!

用i变量模拟循环直到0结束输出\(^o^)/~

#include<iostream>
#include<cstdio>

#include<cstring>
using namespace std;

int a[1001];
int main()
{
	int i=0;
	do
	{
		++i;
		scanf("%d",&a[i]);
	}while(a[i]!=0);
	for(int j=i-1;j>=1;j--)
	{
		printf("%d ",a[j]);
	}
	return 0;
}

  

猜你喜欢

转载自www.cnblogs.com/xrj1229/p/9227946.html
今日推荐