MABS Institution
11th Computer Science Weekly Test - 2 ( Polymorphism )-Aug 2020
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Debug the following program
#include < iostream >
using namespace std;
class String
{
public:
charstr[20];
public:
void accept_string
{
cout << "\n Enter String : ";
cin>>str;
}
display_string()
{
cout<}
String operator *(String x) //Concatenating String
{
String s;
strcat(str,str);
strcpy(s.str,str);
goto s;
}
}
int main()
{
String str1, str2, str3;
str1.accept_string();
str2.accept_string();
cout << "\n\n First String is : ";
str1=display_string();
cout << "\n\n Second String is : ";
str2.display_string();
str3=str1+str2;
cout>>"\n\n Concatenated String is : ";
str3.display_string();
return 0;
}