Actually,
Code:
#include <iostream>
#include <string>
std::string begins(std::string string1, std::string string2); //Declares Function
int main()
{
std::string input1; //First string
std::string input2; //Second string
std::cout << "Please enter the first string: ";
std::getline(std::cin, input1); //Gets first string
std::cout << "Please enter the second string: ";
std::getline(std::cin, input2); //Gets second string
begins(input1, input2); // Calls Function
return (0);
}
void begins(std::string string1, std::string string2)
{
//Will Contain control statments to determine if input1 contains input2
}
Now, what will begins() do? Will it modify either of the strings? Right now, when you call your function, it will copy the given strings so that the function has its own special copies. Will that be necessary? I'm willing to say no. So then why not let the function simply refer to the strings you gave it, and in a way where the strings will not be modified?
Code:
void begins(const std::string & string1,const std::string & string2)
{
//Will Contain control statments to determine if input1 contains input2
}
Don't forget to update the declaration.
Now, for what to do with the function (which is up to you)... you're going to be finding something... or, maybe considering little strings within the bigger strings...