C++ Programming in Amazon WorkSpace if possible.
A string is a sequence of characters. Write a C++ program by creating a user-defined string class that performs the following functions:
Program:
#include<iostream>
using namespace std;
class StringDemo
{
public:
string str1,str2;
StringDemo(string str11,string str22)
{
str1=str11;
str2=str22;
}
void Comparison()
{
if(str1==str2)
{
cout<<"Both the strings are equal!!"<<endl;
}
else
{
cout<<"Both the strings are not equal!!"<<endl;
}
}
void Concatenation()
{
string str3=str1+str2;
cout<<"\nConcatenation of "<<str1<<" and
"<<str2<<" : "<<str3<<endl;
}
void Length()
{
cout<<"Lenght of first string:
"<<str1.size()<<endl;
cout<<"Lenght of second string:
"<<str2.size()<<endl;
}
void ReverseString()
{
cout<<"Reverse of first string: ";
for(int i=str1.size()-1;i>=0;i--)
{
cout<<str1[i];
}
cout<<"\nReverse of second string: ";
for(int i=str2.size()-1;i>=0;i--)
{
cout<<str2[i];
}
}
};
int main()
{
string s1,s2;
cout<<"Enter first string: ";
cin>>s1;
cout<<"Enter second string: ";
cin>>s2;
StringDemo sd(s1,s2);
sd.Concatenation();
sd.Comparison();
sd.Length();
sd.ReverseString();
return 0;
}
Output:

C++ Programming in Amazon WorkSpace if possible. A string is a sequence of characters. Write a...
A string is a sequence of characters. Write a C++ program by creating a user-defined string class that performs the following functions: String comparison String concatenation Returning the length of the string Reversing a string backward Reversing a string backward
MIPS programming question Problem 1: Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the...
JAVA Programming scenario: write a program that will prompt a user for 10 legendary people/characters. After the entries are complete the program will display all 10 characters information. requirements: Create a user-defined class with the fields below: - First - Last - Nickname - Role - Origin Create a main-source that will use the user-defined class and do the prompting. Create get/set methods in your user-defined class and methods in the main-source.
JAVA PROGRAMMING QUESTION scenario: write a program that will prompt a user for 10 legendary people/characters. After the entries are complete the program will display all 10 characters information. Requirements: Create a user-defined class with the fields below: First Last Nickname Role Origin Create a main-source that will use the user-defined class and do the prompting. Create get/set methods in your user-defined class and methods in the main-source.
2. (50 marks) A string in C++ is simply an array of characters with the null character(\0) used to mark the end of the string. C++ provides a set of string handling function in <string.h> as well as I/O functions in <iostream>. With the addition of the STL (Standard Template Library), C++ now provides a string class. But for this assignment, you are to develop your own string class. This will give you a chance to develop and work with...
In C Programming Language
In this lab you will implement 4 string functions, two using array notation and two using pointers. The functions must have the signatures given below. You may not use any C library string functions. The functions are 1. int my strlen (char s ) - This function returns the number of characters in a string. You should use array notation for this function. 2. int my strcpy (char s [], char t I)- This function overwrites...
A palindrome is a word, phrase, number, or other sequence of symbols or elements that reads the same forward or reversed. Examples: “Dad”, “Anna”, “Never odd or even”, etc. For this problem, we will only consider a string to be palindromic if its combined alpha-numeric characters (‘A’-’Z’, ‘a’-’z’, and ‘0’-’9’) can be read the same both forward and backward, by skipping all other non-alphanumeric characters.Write the following function that takes a user input string, computes, and determines whether the input is palindromic or not...
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...
using C programming Compose a program that declares two string arrays that are 81 characters in size. Prompt the user to enter in a string and store it in array 1. Construct a function that returns a void and takes both arrays as parameters and copies array 1 into array 2 using sizeof() to ensure that the size does not exceed the destination array. Back in the caller print the second array to show that the function worked. NOTE: We...
Write a C program that acquires a sequence of characters from the keyboard. The sequence ends once the user enters the newline character, i.e., hits the ENTER key. The program modifies the entered sequence by: • First replacing every occurrence of the sequence "ch” with the letter "K" • Then replacing all occurrences of the sequence "oo" with the letter "u" . And then replacing all occurrences of the sequence "ee" with the letter "j" and prints the modified version...