1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
balu736 [363]
3 years ago
8

Write a program that initializes a string with Mississippi Then replace all i with ii and print the length of the resulting stri

ng. In that string replace all ss with s and print the length of the resulting string.
Computers and Technology
1 answer:
Katyanochek1 [597]3 years ago
3 0

Answer:

Explanation:

#include <bits/stdc++.h>  

using namespace std;  

string replace(string s, char c1, char c2)  

{  

   int l = s.length();  

 

   // loop to traverse in the string  

   for (int i = 0; i < l; i++) {  

 

       // check for c1 and replace  

       if (s[i] == c1)  

           s[i] = c2;  

 

       // check for c2 and replace  

       else if (s[i] == c2)  

           s[i] = c1;  

   }  

   return s;  

}  

 

// Driver code to check the above function  

int main()  

{  

   string s = "Mississippi";  

   char c1 = 'i', c2 = 's';  

   cout << replace(s, c1, c2);  

   return 0;  

}

You might be interested in
The UNIX operating system started the concept of socket which also came with a set of programming application programming interf
VMariaS [17]

Answer:

(a). as the combination of IP address and port number to allow an application within a computer to set up a connection with another application in another computer without ambiguity.

Explanation:

The explanation is in the answer.

3 0
3 years ago
Wanda wants to find some basic information about her computer, for example, what operating system and how much RAM are installed
Gnoma [55]

Answer:

Its very simple you just need to go on your desktop there right click on Computer/This PC icon and then click on properties. Here you can have all the basic information of the PC including OS version processor and RAM.

6 0
3 years ago
Write a function checkPalindrome that accepts a single argument, a string. The function should return true (Boolean) if the stri
Vsevolod [243]

Answer:

Following are the program in the Java Programming Language.

//define function

public static boolean checkPalindrome(String str){

//set integer variable to 0

int a = 0;

//set integer variable to store the length of the string

int n = str.length() - 1;  

//set the while loop to check the variable a is less than the variable n

while(a<n)

{

//check the string character is not in the variable n

if(str.charAt(a)!= str.charAt(n))

//then, return false

return false;  

//the variable a is incremented by 1

a++;

//the variable n is decremented by 1

n--;

}

//and return true

return true;

}

Explanation:

<u>Following are the description of the following function</u>.

  • Firstly, we define boolean type public function that is 'checkPalindrome' and pass string data type argument 'str' in its parameter.
  • Set two integer data type variables that are 'a' initialize to 0 and 'n' which store the length of the string variable 'str' decremented by 1.
  • Set the While loop that checks the variable 'a' is less than the variable 'n', then we set the If conditional statement to check that the string character is not in the variable n then, return false.
  • Otherwise, it returns true.
5 0
4 years ago
How can you continue learning about computer science and improve your coding abilities?
Crank

Answer:

5 Ways to Improve Your Coding and Programming Skills

Take advantage of books and other free resources. ...

Sign up for a bootcamp. ...

Practice, practice, practice. ...

Engage with the computer science community. ...

Pursue a formal education in computer science.

7 0
3 years ago
Write a program having a concrete subclass that inherits three abstract methods from a superclass. Provide the following three i
hammer [34]

Answer:

C++

Explanation:

using namespace std;

class AbstractClass {

public:  

   virtual bool checkUpperCase(string inputString);

   virtual string lowerToUppercase(string inputString);

   virtual void stringToInt(string inputString);

};

class ConcreteClass: public AbstractClass {

public:

   bool checkUpperCase(string inputString) {

       bool isUpper = false;

       for (int i=0; i < strlen(inputString);  i++) {

           if (isupper(inputString[i])) {

               isUpper = true;

               break;

           }

       return isUpper;

      }

   string lowerToUppercase(string inputString) {

       for (int i=0; i < strlen(inputString);  i++) {

           putchar(toupper(inputString[i]));

       }

       return inputString;

   }

   void stringToInt(string inputString) {

       int convertedInteger = stoi(inputString);

       convertedInteger+=10;

       cout<<convertedInteger<<endl;

   }

};

int main() {

   ConcreteClass cc;

   return 0;

}

3 0
3 years ago
Other questions:
  • You want to discard your old computer but want to securely erase the data from your hard drive, what can Use to do this?
    5·1 answer
  • If a person was on board a hypersonic airplane what do you think they would be able to see as they look out a window looking in
    13·2 answers
  • Select the correct answer. One of the functions of a data warehouse is to change table names to meaningful names. Which name is
    13·1 answer
  • The main memory of a computer is made up of a set of memory chips called ___ and ___.
    10·1 answer
  • What is the advantage of postfix notation?
    6·1 answer
  • Do you think that using robots at home would be good and helpful?
    11·1 answer
  • Historically, storytelling passed down the most important ideas about life, family, and society from generation to generation; t
    10·2 answers
  • What is kerning in Adobe Indesign
    7·1 answer
  • Is a mainframe computer portable?​
    10·1 answer
  • PLEASE HELP!! THIS IS DUE SOON.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!