#include<math.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int times, notzero=-1, alltimes, index = 0;
char number[60] = { 0 };
for (int i = 0; i < 10; i++)
{
scanf("%d", &alltimes);
times = 0;
while (times != alltimes)
{
if (i == 0) notzero = index;
number[index] = 48 + i;
index++; times++;
}
}
if (notzero != -1)
{
int tmp = number[notzero + 1];
number[notzero + 1] = number[0];
number[0] = tmp;
}
for (int i = 0; i <index; i++)
printf("%c", number[i]);
return 0;
}
浙大PAT乙级1023 组个最小数
C++数组操作与字符串打印
最新推荐文章于 2022-08-02 15:44:22 发布
本文介绍了一个使用C++进行数组操作和字符串打印的示例程序。该程序通过读取整数输入来填充字符数组,并根据特定条件调整数组元素的顺序,最后将数组内容以字符串形式打印出来。涉及的主要技术包括C++基本语法、数组处理和字符输出。
74

被折叠的 条评论
为什么被折叠?



