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]
3 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]3 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
Which engineer may design a GPS for a vehicle?
Crank

Explanation:

Mechanical engineer may design a gps for a vehicle.

4 0
2 years ago
Allan needs to ensure that an object is in a very precise location on a slide. He decides to use the Ruler option to achieve thi
shusha [124]

Answer:

It can be found on View tab.

Explanation:

The view tab on Microsoft Power point is the 9th tab when counting from the left. When clicked, the view tab displays a number of tools that are aimed at visualizing how slides appear.

The ruler function is one of those tools. It is used to ensure that an object is placed or appears at a specific location in the slides. The ruler tool can be found in the Show Box which is the third box from left after Presentation View and Master View.

8 0
3 years ago
Read 2 more answers
If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
erastova [34]

Answer:kk ima do it

Explanation:

7 0
3 years ago
Read 2 more answers
To what would you compare the transport layer?
Nikolay [14]
The above question has multiple choices as below

A. Data links
B. The post office
C. Driving a car
D. A train

The answer is (B) The Post Office.

In layman’s terms, transport layer is similar to the post office functions of delivering parcels and letters at the agreed delivery deadlines. It also notices any dropped info and re-transmits it.
Just like the post office, the transport layer directs messages and information between specific end users. If by mistake you write a letter to the wrong person, the letter will be returned and the postal employee will stamp it as address unknown.


6 0
3 years ago
During what months do most people file their taxes?
navik [9.2K]

Answer:

Explanation:

What Is Tax Season? Tax season is the time period, generally between Jan. 1 and April 15 of each year, when individual taxpayers traditionally prepare financial statements and reports for the previous year and submit their tax returns.

4 0
2 years ago
Read 2 more answers
Other questions:
  • What is the most efficient way to include a space after each paragraph?
    13·2 answers
  • Julie bought a house for $315,000 and has a $285,000 mortgage. she claims she has $315,000 in equity. is she correct? if not, ho
    12·2 answers
  • Which computer device is used to capture or copy a photograph to place in a report?
    14·1 answer
  • Software that gives network administrators the ability to provide computer assistance from a central location by allowing them t
    15·1 answer
  • A user has just reported that he downloaded a file from a prospective client using IM. The user indicates that the file was call
    11·1 answer
  • For what purpose is keylogging software used? a. To automatically translate input to another language as the user enters data b.
    10·1 answer
  • What is computer graphics? define​
    11·1 answer
  • What videos do you think we should make next?
    9·1 answer
  • 1. Identify one modern technology and discuss its development and discuss what future changes might occur that could have an eve
    13·1 answer
  • _____ allows a function or operator to perform different tasks depending on the types of the arguments or operands. Group of ans
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!