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
Sladkaya [172]
4 years ago
15

Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin

g. Call that method notstartswith
Computers and Technology
1 answer:
Stolb23 [73]4 years ago
3 0

Answer:

#include <iostream>

using namespace std;

class Str{  ///baseclass

   public :

   string super_str;

   string getStr()

   {

       return super_str;

   }

   void setStr(string String)

   {

       super_str=String;

   }

};

class str : public Str{   //inheriting Str publicly

   public :

       string sub_str;

       string getstr()

       {

           return sub_str;

       }

       void setstr(string String)

       {

           sub_str=String;

       }

       bool notstartswith()

       {

           int n=sub_str.length();   //to find length of substr

           bool flag=false;

           for(int i=0;i<n;i++)     //Loop to check beginning of Str

           {

               if(super_str[i]!=sub_str[i])

               {

                   flag=true;

                   break;

               }

           }

           return flag;

       }

};

int main()

{

   str s;    //object of subclass

   s.setStr("Helloworld");  

   s.setstr("Hey");

   if(s.notstartswith()==1)     //checking if str is substring of Str

       cout<<"Str does not start with str";

   else

       cout<<"Str starts with str";

   return 0;

}

OUTPUT :

Str does not start with str

Explanation:

Above program is implemented the way as mentioned. for loop is being used to check the beginning of the str starts with substring or not.

You might be interested in
The first step to changing lanes is
lisov135 [29]
It’s obviously C.Signaling your intent by using your blinkers also known as the lights at the back of your car!
3 0
3 years ago
Read 2 more answers
Match the following: B. Static libraries A. Dynamic Link Libraries (DLL) - Using static libraries - Making some changes to DLL A
TiliK225 [7]

Answer:  hello your question is poorly written and I have been able to properly arrange them with the correct matching

answer

Static libraries :  C

Dynamic link libraries:  A

Using static libraries:  B

Making some changes to DLL:   D

Explanation:

Matching each term with its meaning

<u>Static Libraries </u> : Are attached to the application at the compile time using the Linker ( C )

<u>Dynamic link libraries</u> ( DLL ) : Is Loaded at runtime as applications need them ( A )

<u>Using static Libraries </u>: Makes your program files larger compared to using DLL ( B )

<u>Making some changes to DLL </u>: Does not require application using them to recompile ( D )

8 0
3 years ago
Considering all of the time and effort that is put into creating an online business, it is in a merchant’s best interest to make
givi [52]

Search engine optimization will help increase the number of clicks on the business' website and help to drive the sales by targeting the appropriate audience for buying the products.

<h3>What is search engine optimization?</h3>

Search engine optimization, or SEO, is one of the most important functions of the generation of organic clicks on the website for an online ecommerce business.

It helps in creating a brand awareness, the costs of advertising are much lower, and also helps in improving the experience of the customers of ecommerce site.

Hence, the uses of search engine optimization in online business are as aforementioned.

Learn more about Search Engine Optimization here:

brainly.com/question/14850803

#SPJ1

4 0
2 years ago
Which tool did Adnan use to modify the image?
artcher [175]

Answer:

D

Explanation:

4 0
3 years ago
Read 2 more answers
You want to add the same functionality to various web sites you have created for your school district without having to add the
Shkiper50 [21]
You should place your javascript in a separate file and name it appropriately, e.g. script.js.

Then you should call for your script using the HTML:

<script src="script.js" type="text/javascript"<span>></script></span>
3 0
3 years ago
Other questions:
  • Match the following.
    8·2 answers
  • HURRY
    5·1 answer
  • What are two constraints that continuous-media files have that conventional data files generally do not have?
    12·1 answer
  • Communications that take the form of electronic junk mail or unsolicited e-mail are referred to as
    13·2 answers
  • In its simplest form, the __________ has two columns: the first column lists every computer and device in the network, while the
    15·1 answer
  • Select the correct answer.
    12·2 answers
  • You have to calculate the total amount you spent at the mall today. Which function should you use to do so?
    6·2 answers
  • A security administrator wants to empty the DNS cache after a suspected attack that may have corrupted the DNS server. The serve
    12·1 answer
  • Which type of choir often sings AND dances while they perform?
    9·1 answer
  • There are a wide variety of nonsampling errors that can occur during data collection including the first type, ________.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!