Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone fix the errors ? //manipulating V2 #include manipulating.h void manipulating() { //printing on screen.. printf(*** Start of Concatenating Strings Demo *** ); //variables

can someone fix the errors ?

//manipulating V2

#include "manipulating.h"

void manipulating() {

//printing on screen..

printf("*** Start of Concatenating Strings Demo *** ");

//variables of type char arrays/string declaration..

char string1[80];

char string2[80];

char compare1[256];

char compare2[256];

int result;

//Infinite loop to concate two user inputted string until first string is q..

while (true) {

//taking string 1 from user..

printf("Type the 1st string (q - to quit): ");

gets(string1);

//Checking for input if it is q then break the infinite loop

if (strcmp(string1, "q") == 0)

break;

//taking string 2 from user..

printf("Type the 2nd string: ");

gets(string2);

//Concate both the string

strcat(string1, string2);

//printing output..

printf("Concatenated string is %s ", string1);

}

printf("*** End of Concatenating Strings Demo *** ");

printf("*** Start of Comparing Strings Demo *** ");

while (true) {

printf("Type the 1st string to compare (q - to quit) : ");

gets(compare1);

if (strcmp(compare1, "q") == 0) break;

printf("Type the 2nd string to compare: ");

gets(compare2);

result = strcmp(compare1, compare2);

if (result < 0)

printf("1st string is less than 2nd ");

else if (result == 0)

printf("1 string is equal to 2nd ");

else

printf("1st string is greater than 2nd ");

printf("*** End of Comparing Strings Demo *** ");

}

}

prinf("***Start of Searching Strings Demo *** "); The errors start from here, everything on the top is working properly

char big_string[80];

char sub_string[80];

char* address;

while (TRUE) {

printf("Type the big string (q - to quit): ");

gets(big_string);

if (strcmp(big_string, "q")-- 0) break;

printf("Type the substring: ");

gets(sub_string);

address = strstr(big_string, sub_string);

if (address != NULL)

printf("Found at %u position ", address - big_string);

else

printf("Not Found ");

}

printf("***End of Searching Strings Demo *** ");

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

i need a flowchart for the below code in python thanks

Answered: 1 week ago

Question

Your Turn 3 Find VW 4 Find YZ X 7x 17 4y 7 T 12y 14 W 8x 2 Z

Answered: 1 week ago

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago