我写的程序是已知句子中单词的个数的,如果有人会不用知道单词个数就可以实现的,麻烦指点一下,新手
#include "stdafx.h"
#include<iostream>#include<string>
const int ArSzie = 10;
int main()
{
int n;
std::cin >> n;
std::string word[ArSzie];
for (int i = 0; i < n; i++)
std::cin >> word[i];
for (int i = 0, j = n - 1; i <n / 2; i++, j--)
{
std::string t;
t=word[i];
word[i] = word[j];
word[j] = t;
}
for (int i = 0; i < n; i++)
std::cout << word[i] << " ";
return 0;
}