Facebook
From Bistre Macaw, 4 Years ago, written in C++.
This paste is a reply to Untitled from Paltry Hog - view diff
Embed
Download Paste or View Raw
Hits: 239
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. string& and_(string& s, const string& s1, const string& s2)
  7. {
  8.         if (s1.length()> s1.length())
  9.         {
  10.                 for (int i = 0; i < s1.length(); i++)
  11.                 {
  12.                         if (s1[i]==s2[i])
  13.                         {
  14.                                 s += s1[i];
  15.                         }
  16.                 }
  17.                 return s;
  18.         }
  19.         else
  20.         {
  21.                 for (int i = 0; i < s2.length(); i++)
  22.                 {
  23.                         if (s1[i] == s2[i])
  24.                         {
  25.                                 s += s2[i];
  26.                         }
  27.                 }
  28.                 return s;
  29.         }
  30.        
  31. }
  32. int main()
  33. {
  34.         char* str_temp = new char[255];
  35.         string* s = new string[255];
  36.         string s1 = "Hello";
  37.         string s2 = "Hell";
  38.  
  39.         cout << and_(*s, s1, s2) << endl;
  40.         return 0;
  41. }
  42.  

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Sweltering Porcupine cpp 4 Years ago.
Re: Re: Untitled Cute Treeshrew cpp 4 Years ago.
Re: Re: Untitled Flying Pheasant cpp 4 Years ago.
Re: Re: Untitled Rude Butterfly cpp 4 Years ago.
Re: Re: Untitled Sludgy Peccary cpp 4 Years ago.