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
Cómo se hacían antes las cosas que hoy en día se hacen apoyadas en aplicaciones y software?
KatRina [158]

Answer:

Las cosas que hoy en día se hacen apoyadas en aplicaciones y el software se hacían de manera manual, artesanal o empírica, es decir, antes del avenimiento de la era digital, las tareas que hoy se han automatizado o informatizado se realizaban de forma analógica, mediante procesos con una participación humana mucho más fuerte.

Así, por ejemplo, en el entrenamiento, la medición de variables por parte de los entrenadores respecto de los atletas era procesada de forma manual: la comparación de las distintas estadísticas era recopilada en formato físico, y analizada en forma personal por profesionales idóneos para tal tarea, mientras que hoy en día esa tarea se ha automatizado y es llevada a cabo por programas informáticos específicos.

A su vez, respecto de la tecnología, por ejemplo, el análisis de las variables de mercado y la subida o bajada de distintos valores era sistemáticamente analizada en forma manual, mientras hoy en día diversos programas permiten realizar un análisis técnico y financiero en forma digital.

6 0
3 years ago
The presentation ____ determines the formatting characteristics of fonts and colors.
leonid [27]
The presentation theme determines the formatting characteristics of fonts and colors.
6 0
3 years ago
Read 2 more answers
In this lesson you wrote code to make the turtle draw squares. Briefly describe how the code for
ale4655 [162]

Explanation:

that programming language you must use?

3 0
2 years ago
How has the global marketplace used emerging technologies to expand businesses
madam [21]

Answer:

Information Technology (IT) has revolutionized the way organizations conduct business by enabling small and medium businesses to level the playing field with larger organizations. Small businesses use an array of technology based on everything from computer server stations to portable mobile devices to expand competitive advantages in the global economic marketplace and marketing environment. So, small & medium business organizations owners are considering implementing information technology (IT) in their planning process for streamlined integration. Thus, this process is leading to future business expansion locally as well as globally. This decision allows proprietors to create smooth business operations using the most effective information technology available. On the other hand, the Internet has further linked the overseas suppliers of goods and services and their buyers. During the e-commerce era, internet traffic is increasing day by day, and e-commerce business is in the hyper growth stage. Information technology tremendously helps to boost the expansion of the current and future of marketing environment; communication technology became faster than ever. Though, globalization creates a little challenge for multinational companies to share resources and knowledge across a number of businesses inside and outside the country. Outsourcing and freelancer ease this challenge because multinational companies recruit talent freelancers and outsource their projects to the highly expert vendors and then the works are done through the team of people very effectively and efficiently.

Explanation:

6 0
2 years ago
If not cleared out, log files can eventually consume a large amount of data, sometimes filling a drive to its capacity. If the l
OLEGan [10]

Answer:

<u>/var</u>

Explanation:

The /var subdirectory contains files to which the system writes data during the course of its operation. Hence, since it serves as a system directory, it would prevent log files from consuming a large amount of data.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Difference between implicit and explicit type casting
    7·2 answers
  • A computer’s memory is composed of 8K words of 32 bits each. How many bits are required for memory addressing if the smallest ad
    10·1 answer
  • True false) ther are five arrow keys on the keborad​
    9·1 answer
  • What is the impact of information technology in your daily life?
    12·1 answer
  • In python:
    14·1 answer
  • Which of the following is not a shared characteristic of new media.
    8·1 answer
  • From your fist impression, write down what first comes to mind as to what is good and bad about the way the device works.
    14·1 answer
  • Write a program that inputs a five-digit integer, spearates the integer into its digits and prints them seperated by three space
    6·1 answer
  • Which of the following is not a data visualization technique?
    6·1 answer
  • Which phrase is the best definition of social media?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!