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
Write a memo to the vice president, outlining the steps an employee might have taken to create an e-mail message and make it app
Natali [406]

Answer:

Following are the memo to the vice president:

Explanation:

In this question, the president claims, that he got a threatening e-mail from the Maui worker. HR acknowledged that all of the workers should always be dismissed, in its protection, that worker claims that he did not send the message but he does not recognize why the message implies him return address. Here is a note for the vice president, who explains how an employee could have produced an email and made it look to be from another worker's account. That stuff we want will be progressively explained as follows:

a) The manipulating and e-mail used only by spammers and attackers were called this technique. In the SMTP server, it sends messages, that you can set up to send your spammer to the email addresses. Instead of a mail confirmation, I d the forger requires the receiver to see the next employee I d email. that recipient doesn't understand who sent the message.

b) The e-mail Systems information allowing for accessible transfer is used by the intruder or forger. It  must use an attacker order to verify communication with the SMTP server command:  

telnet smpt.server.name 25    

Its name of the SMTP server is smpt.domain.name, and the port is 25.

c) when the last stage is successful as well as a link created, this order to imitate an email account only with command can be entered:

MAIL from: Email-id

It creates a problem for the worker that sends the e-mail with the same id

d) Hacker sets the email of the receiver to:  

RCPT to: boss email-id  

It sets the beneficiary as the e-mail above.  

e) By entering an order, you can create the email data:  

DATA It may also adjust the date by using command and Any date we would like to use.  

Date: (date you would like)  

We should settle on the following:  

Subject: (your topic)

f) We press Insert after the topic is written. In this body can then be e-mail forms. It produces the text.  

g) its email forged is forwarded.

3 0
3 years ago
Create a text file named employee.dat containing the following data: b. Write a C++ program to read the employee.dat file create
Paul [167]

Answer:

1000 500 250 125 the output

Explanation:

write a program using integers userNum and x as input,  userNum divided by

x four times.  EX : If  the input is 2000 2 the output is 1000 500 250 125

8 0
3 years ago
10. Which of these is not an HTTP verb? PUT AJAX GET DELETE
Korolek [52]

Answer:

Brainliest!

Explanation:

The primary or most-commonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete (or CRUD) operations, respectively. There are a number of other verbs, too, but are utilized less frequently.

-

restapitutorial

.

com

3 0
3 years ago
Suppose that the following elements are added in the specified order to an empty binary search tree: Kirk, Spock, Scotty, McCoy,
patriot [66]

Answer:

Pre-order: Kirk, Chekov, Khaaaan, Spock, Scotty, McCoy, Sulu, Uhuru

In-order: Chekov, Khaaaan, Kirk, McCoy, Scotty, Spock, Sulu, Uhuru

Post-order: Khaaaan, Chekov, McCoy, Scotty, Sulu, Uhuru, Spock, Kirk

Explanation:

The binary search tree is described in the diagram below.

The pre-order traversal of the binary tree gets the root, then the left node and right node. The in-order traversal picks the left node, the root node, and then the right node while the post-order traversal of the binary tree follows the left node, right node, and then the root node.

6 0
3 years ago
Sonic the Hedgehog (1991)
e-lub [12.9K]

Answer:

What if we made a fast game?

Explanation:

The mascot is the person, animal or thing which brings good luck, just like Mario. However, this is not a problem with Sonic the Hedgehog. And the Hedgehog is powerful enough to cross any barrier. Hence tieing the collectibles is not required. And the Hedgehog is quite cute and domestic. But it moves only 10 meters per second if we are considering the maximum speed. Hence, the correct option is certainly what if we made a fast game? And this is option C.

7 0
3 years ago
Other questions:
  • Dan is a Civil Engineer for a company that builds nuclear power plants throughout the world. Which best describes the places he
    14·2 answers
  • How long does it take a letter to arrive?
    9·1 answer
  • Enter the value of 5⋅(13.5−4.5). <br> ​
    5·1 answer
  • Instructions
    12·1 answer
  • A tool you might use to manipulate an image, such as a photograph, into a seamless repeating texture would be:
    7·2 answers
  • Enterprise Resource Planning (ERP) is an example of a single user database.
    7·1 answer
  • In cell B20, enter a function to calculate the average attendance for 2018
    11·1 answer
  • If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
    8·1 answer
  • Which are examples of types of audio media that can support a presentation? Check all that apply.
    14·2 answers
  • Adam has designed and tested an Android app for a startup. The client expects to get quick responses to the app. After consultin
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!