C PROGRAM FOR CHECKING WEATHER GIVEN TWO STRINGS ARE EQUAL OR NOT AND CONCATENATE THEM.
#include <stdio.h>
#include <string.h>
int main()
{
int n,k,l;
char str1[50], str2[50], i, j;
printf("\nEnter first string: ");
scanf("%s",str1);
printf("\nEnter second string: ");
scanf("%s",str2);
n=strlen(str1);
k=strlen(str2);
if(n==k)
{
printf("\n ---Two strings are equal---");
printf("\n Firstt string =%s",str1);
printf("\n Second string =%s",str2);
printf("\n Length %d",n);
}
else
///////////////// /* This loop is to store the length of str1 in
i
//////////////////// * It just counts the number of characters in
str1
{
printf("\n ---Two strings are not equal---");
for(i=0; str1[i]!='\0'; ++i);
/////////////////////* This loop would concatenate the string str2
at the end of str1
for(j=0; str2[j]!='\0'; ++j, ++i)
{
str1[i]=str2[j];
l=strlen(str1);
}
/////////////// // \0 represents end of string
str1[i]='\0';
printf("\nConcatenated output: %s",str1);
printf("\nLength %d",l);
}
return 0;
}
use C language please Problem 5. (5 points] Use string functions. Write a program that: 1)...
Write a C++ program that contains the following functions. Have at least 3 arrays created in the main to test your functions using appropriate function calls ReadIn (A Function that request the user to fill up 2 arrays of size 10) CompareFunc (A function that takes in 2 arrays and compares them, and outputs an appropriate message if they are the same or not) ReverseFunc ( A function that takes in 2 arrays, and copies the content of the the...
Write the code in python programming Language String Statistics: Write a program that reads a string from the user and displays the following information about the string: (a) the length of the string, (b) a histogram detailing the number of occurrences of each vowel in the string (details provided below), (c) the number of times the first character of the string occurs throughout the entire string, (d) the number of times the last character of the string occurs throughout the...
Please note that I cannot use the string library function and that it must be coded in C89, thank you! Formatting: Make sure that you follow the precise recommendations for the output content and formatting: for example, do not change the text in the first problem from “Please enter a string of maximum 30 characters:” to “Enter string: ”. Your assignment will be auto-graded and any changes in formatting will result in a loss in the grade. 2.Comments: Header comments...
C Programming Language only please. Your help is greatly
appreciated. Will give thumbs up for quality work.
Lab 8 (this is to be turned in) Palindrome is a string that is the same as backwards or forwards “otto” “ababa” “noon” “ababbbbaba” In this lab we will work with strings (so we will be using character arrays). 1. Write a program that reads two strings strl and str2 from the keyboard 2. Print both strings 3. Write a function computeLength and...
This program should be run on Visual Studio. Please use printf
and scanf as input and output. Thank you
6.12 Lab Exercise Ch.6b: C-string functions Create and debug this program in Visual Studio. Name your code Source.c and upload for testing by zyLabs You will write 2 functions which resemble functions in the cstring library. But they will be your own versions 1. int cstrcat(char dstDchar src) which concatenates the char array srcl to char array dstD, and returns the...
**IN C***
*
In this lab, you will write a program with three recursive functions you will call in your main. For the purposes of this lab, keep all functions in a single source file: main.c Here are the three functions you will write. For each function, the output example is for this array: int array[ ] = { 35, 25, 20, 15, 10 }; • Function 1: This function is named printReverse(). It takes in an array of integers...
C++
St// 105 points Problem 5 | 15 Points | Polymorphism and Virtual functions led Top. It has one public method called print that prints out the following expression "I am the parent" Create a class called Bottom that is inherited from the class Top.It has one public method also called print that prints out the following expression"I am the child e Write a function called mainprint that takes as input a class instance of type Top. This function will...
IN C language Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr andcreadLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate...
Problem 1: Dynamic Grocery Array Using Java to write a program that prompts the user to enter an item’s name for each position in the array. The program then prints uses a loop to output the array. Example 1: Banana 2: Orange 3: Milk 4: Carrot 5: Chips Banana, Orange, Milk, Carrot, Chips Problem 2: Print Characters in String Array Declare a string array of size 5. Prompt the user enters five strings that are stored in the array....
C language: Write a program that uses a function to check if a user entered string is a palindrome. Based on the return value of the function, the results are printed in the main() function. (do not print results in function to check for palindrome) A palindrome reads the same forward as backward for example tacocat or civic.