用坑爹的VS的代码是这样的
#include<stdio.h>
#include<string.h>
#define N 5
int main()
{
char str[100], afstr[100];
int i=0, b, k, a, order[N];
printf("plesae input strings:");
gets_s(str,100);
k = strlen(str);
printf("please input new order:");
for (i = 1; i <= N; i++)
scanf_s("%d", &order[i]);
for (i = 1; i <= k; i++)
{
a = i / N; b = i%N;
afstr[(a * N + order[b]-1)] = str[i - 1];
}
puts(afstr);
return 0;
}
#include<stdio.h>
#include<string.h>
#define N 5
int main()
{
char str[100], afstr[100];
int i=0, b, k, a, order[N];
printf("plesae input strings:");
gets_s(str,100);
k = strlen(str);
printf("please input new order:");
for (i = 1; i <= N; i++)
scanf_s("%d", &order[i]);
for (i = 1; i <= k; i++)
{
a = i / N; b = i%N;
afstr[(a * N + order[b]-1)] = str[i - 1];
}
puts(afstr);
return 0;
}