Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you write a code for void swapEvensOnly(char *s3) ( Using C language ) #include #include #include typedef unsigned int ui; //

Can you write a code for 

void swapEvensOnly(char *s3)

( Using C language )

 

#include

#include

#include

 

typedef unsigned int ui;

 

// function prototypes:

void replaceAtDotWithUnderscores(char *s1);

ui howManyNonVowelAlphas(const char *s2);

void swapEvensOnly(char *s3);

 

int main( ) {

   int i;

   ui rv;

 

   char words1[4][31] = { "..l@host.domain", "@@..", "no changes here!", "What@Me@Worry?" };

   char words2[3][81] = { "123-xyz", "This is PRG355@SENECA", "a e i o u???" };

   char images[3][31] = { "123456789", "hello world", "six" };

 

   for(i=0; i<4; i++) {

      replaceAtDotWithUnderscores(words1[i]);

      printf("'%s'\n", words1[i]);

   }

   for(i=0; i<3; i++) {

      rv = howManyNonVowelAlphas(words2[i]);

      printf("%u\n", rv);

   }

   for(i=0; i<3; i++) {

      swapEvensOnly(images[i]);

      printf("%s\n", images[i]);

   }

 

   return 0;

}

 

 

 

void replaceAtDotWithUnderscores(char *s1) {

 

  // your code here ...

}

 

ui howManyNonVowelAlphas(const char *s2) {

 

  // your code here ...

}

 

void swapEvensOnly(char *s3) {

 

  // your code here ...

}

 

=======================================

 

Requires below

 

 

Q3. Write a C function with the following prototype:

void swapEvensOnly(char *s3)

that accepts a string 's3' containing at least 3 characters such that the

string will always have a length that is an odd number and reverses the

order of ONLY the characters in the string with even numbered indexes as follows:

First character is replaced by the last character, third character is replaced by

the third last character, etc.

 

For example,

original string:                               altered string:

 

"123456789"                                    "927456381"

"hello world"                                  "derlw oollh"

"six"                                                   "xis"

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_2

Step: 3

blur-text-image_3

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

An Introduction to Programming with C++

Authors: Diane Zak

8th edition

978-1285860114

More Books

Students also viewed these Algorithms questions