Write a C++ program to create a new string using the two middle characters of a given string of even length (at least 2)
- برمجة سي بلس بلس
- برمجة
- 2021-05-11
- MarwaMohammed
الأجوبة
#include <iostream>
using namespace std;
string test(string s1)
{
return s1.substr(s1.length() / 2 - 1, 2);
}
int main()
{
cout << test("Hell") << endl;
cout << test("JS") << endl;
return 0;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
