In this question, we will utilize a web service that converts Arabic numerals to Roman numerals. Below is a skeleton for using this web service (gsoapNumRoman.rar at VLT) to convert one Arabic number to Roman number. You need to modify the main( ) by introducing a one-dimension integer array: x[5] and assigning the following values to the array elements:
int main( )
{
struct soap *soap = soap_new(); //new soap instance
int num;
string myResult;
int getnum;
cout<<"Number (positive, less than 100000): ";
cin>>getnum;
num = getnum;
if(num>=100000){num=-1;} //limit size of num
if (soap_call_ns1__IntToRoman(soap, NULL, NULL, num, myResult) == 0)
{ //soap method for getting roman number, determined from numRoman.h
if(myResult.compare("")!=0){//if the number is valid
cout<<"\n Number "<<num<<" is "<<myResult<<" \n\n";
}else
{
cout<<"\n Number is invalid...\n\n";
}
}
else
{
soap_print_fault(soap, stderr);
}
soap_destroy(soap); //destroy soap instance
system("pause");
return 0;
}
Hint: You should use a for loop to conduct the conversion for all the array elements and use cout to print out the result on computer screen.
I did introduce the array, but I didn't know how to set the for loop: