C++ Programming Exercises with Solution : Get input and show reverse order of array

C++ progarmming exercise with solution. Let's practice together.
Exericese:
Get input from keyboard. and show the reverse order of it.
Example:

Monitor:
Input a sentence: HelloUBB
Output: BBUolleH

Solution 1:
#include<iostream>
using namespace std;
int main(void){

 char array[30];
 char check;
 int i=0, k=0;

 cout<<"Input a sentence.(no space): ";
 cin>>array;

 //check how many character in array
 while(array[i]!='\0'){
  i++;
 }

 //reverse the order of the array.
 for(k=0;k<i/2;k++){
  char ya = array[k];
  array[k]=array[i-1-k];
  array[i-1-k]=ya;
 }

 cout<<array<<endl;

 return 0;
}
Solution 2:
#include<iostream>
using namespace std;

char array[30];
void ReverseFunction(int i);

int main(void){

 
 char check;
 int i=0, k=0;

 cout<<"Input a sentence.(no space): ";
 cin>>array;

 //check how many character in array
 while(array[i]!='\0'){
  i++;
 }

 //reverse the order of the array.
 ReverseFunction(i);

 cout<<array<<endl;

 return 0;
}

void ReverseFunction(int i){
 int k;
 for(k=0;k<i/2;k++){
  char ya = array[k];
  array[k]=array[i-1-k];
  array[i-1-k]=ya;
 }
}