Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include void A ( char str [ ] ) { for ( int i = 0 ; str [ i ] ! = '

#include
void A(char str[]){
for (int i =0; str[i]!='\0'; ++i){
if ((str[i]<'A'||(str[i]>'Z' && str[i]<'a')|| str[i]>'z')){
str[i]='*';
}
}
printf("A: %s
", str);
}
void B(char str[]){
int length =0;
while (str[length]!='\0'){
++length;
}
int mid = length /2;
char temp;
for (int i =0; i < mid; ++i){
temp = str[i];
str[i]= str[mid + i];
str[mid + i]= temp;
}
printf("B: %s
", str);
}
void C(char str[]){
int length =0;
while (str[length]!='\0'){
++length;
}
int mid = length /2;
for (int i =0; i < mid /2; ++i){
char temp = str[i];
str[i]= str[mid - i -1];
str[mid - i -1]= temp;
}
printf("C: %s
", str);
}
void D(char str[]){
int length =0;
while (str[length]!='\0'){
++length;
}
int mid = length /2;
for (int i =0; i <(length - mid)/2; ++i){
char temp = str[mid + i];
str[mid + i]= str[length - i -1];
str[length - i -1]= temp;
}
printf("D: %s
", str);
}
int main(){
char original[]= "Hello123World";
char order[]= "BACD";
printf("Original: %s
", original);
for (int i =0; order[i]!='\0'; ++i){
switch (order[i]){
case 'A':
A(original);
break;
case 'B':
B(original);
break;
case 'C':
C(original);
break;
case 'D':
D(original);
break;
default:
break;
}
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

=+a) Make a decision tree for these decisions.

Answered: 1 week ago

Question

2.3 Define human resource ethics.

Answered: 1 week ago

Question

9 How can training be evaluated?

Answered: 1 week ago